2 Replies Latest reply on Jun 12, 2013 10:35 AM by nl

    NPE on creating successive mixins (MS 3.3)

    nl Newbie

      Hi,

       

      if I create a mixin, remove it and create it afterwards again, I get an NPE.

      Note that while I use a single session in this example, the exception is also thrown if I use different sessions.

       

       

      {code}

              Session adminSession = createSession("admin", "admin", "repository", "default");

              NodeTypeManager ntmgr = adminSession.getWorkspace().getNodeTypeManager();

              NodeTypeTemplate ndt = ntmgr.createNodeTypeTemplate();

              // create mixin

              ndt.setMixin(true);                               

              ndt.setName("dmsmix:test");

              ndt.setQueryable(true);                       

              ntmgr.registerNodeType(ndt, true);

       

              // remove it

              ntmgr.unregisterNodeType("dmsmix:test");       

       

              // create one with same name again                       

              ndt = ntmgr.createNodeTypeTemplate();       

              ndt.setMixin(true);                               

              ndt.setName("dmsmix:test");

              ndt.setQueryable(true);   

              ntmgr.registerNodeType(ndt, true);  // fails !!!

      {code}

       

      Stacktrace:

       

      {code}

      java.lang.NullPointerException

          at org.modeshape.jcr.cache.document.SessionNode.updateReferences(SessionNode.java:768)

          at org.modeshape.jcr.cache.document.SessionNode.setProperties(SessionNode.java:897)

          at org.modeshape.jcr.SystemContent.store(SystemContent.java:315)

          at org.modeshape.jcr.SystemContent.store(SystemContent.java:256)

          at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeTypes(RepositoryNodeTypeManager.java:516)

          at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeType(RepositoryNodeTypeManager.java:377)

          at org.modeshape.jcr.JcrNodeTypeManager.registerNodeType(JcrNodeTypeManager.java:489)

      {code}

       

      What causes this issue?

       

      Thanks, Niels