1 Reply Latest reply on Apr 22, 2014 4:06 AM by hchiorean

    Check in of imported node fails

    shashov

      Hello.

       

      I'm using modeshape 3.7.2.Final. I'm made an application, that imports a node from XML. Then I try to check in a versionable child of that node (sv:name="demoPDT"), using versionManager.checkin method, and get the following error:

       

      java.lang.NullPointerException

          at org.modeshape.jcr.SystemContent.nextNameForVersionNode(SystemContent.java:1193)

          at org.modeshape.jcr.SystemContent.recordNewVersion(SystemContent.java:1087)

          at org.modeshape.jcr.JcrVersionManager.checkin(JcrVersionManager.java:356)

          at org.modeshape.jcr.JcrVersionManager.checkin(JcrVersionManager.java:304)

          at org.modeshape.example.jdbcstore.ModeShapeExample.main(ModeShapeExample.java:125)

       

      My xml is attached below, I got that xml by using session.exportSystemView method in modeshape 2.8.3.Final. The import itself worked fine, I can see all the imported nodes and read their properties.

      I thought, that this error might be related to the fact, that version history is not imported. I tried removing jcr:baseVersion and jcr:predecessors from xml (the attached version has them already removed), since they hold a reference, that is no longer valid in modeshape 3.7.2. It didn't change the error.

      I don't think that this error is related to my modeshape or infinispan configurations, since everything else is working fine, but I attached it below anyway.

      Do you think there is a way to change an xml to make it possible to check in without error? Could there be some other solution?

       

      Thanks

      Alexey

        • 1. Re: Check in of imported node fails
          hchiorean

          The jcr:predecessors property *should never be empty* (because the rootVersion should always exist and acts as the "default" predecessor) in an exported system view file (if it is, then the export is broken). If the above stack is created using 3.7.2.Final, the NPE seems to occur because the predecessors property is "null" - and I have no idea how that's possible based on the current code. There are several issues & inconsistencies between exporting versionable nodes in 2.8.x and importing them into 3.x. I will address them in [MODE-2192] Error on importXML - JBoss Issue Tracker (which will probably be part of 4.0.0.Alpha2)

           

          In the meantime, the only thing I can think of is to edit the XML by hand and remove *all versioning information* (mixins, properties etc) and then recreate the versions from scratch after importing the base data.

           

          EDIT: If you reproduce this exception in a test case (see modeshape/modeshape-jcr/src/test/java/org/modeshape/jcr/ImportExportTest.java at modeshape-3.7.2.Final · ModeShape/modes… for a test example), please attach the test case to MODE-2192 or submit a pull request with it. Thanks.