2 Replies Latest reply on Oct 12, 2016 11:24 AM by amischler

    NullPointerException in IndexChangeAdapter after copying nodes in the workspace

    amischler

      I encounter the following exception when copying nodes in the Workspace :

       

      javax.jcr.RepositoryException: java.lang.NullPointerException

        at org.modeshape.jcr.JcrSession.save(JcrSession.java:1190) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.JcrWorkspace.copy(JcrWorkspace.java:240) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.JcrWorkspace.copy(JcrWorkspace.java:121) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at com.dooapp.dsdk.persistence.clone.JcrEntityDuplicator.duplicateNode(JcrEntityDuplicator.java:99) ~[classes/:na]

        at com.dooapp.dsdk.persistence.clone.JcrEntityDuplicator.duplicate(JcrEntityDuplicator.java:76) ~[classes/:na]

        at com.dooapp.dsdk.core.persistence.JcromServiceEntityDuplicator.duplicate(JcromServiceEntityDuplicator.java:41) [classes/:na]

        at com.dooapp.dsdk.core.persistence.JcromService.doDuplicate(JcromService.java:451) [classes/:na]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_92]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_92]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_92]

        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_92]

        at org.jrebirth.af.core.service.ServiceTaskBase.call(ServiceTaskBase.java:156) [core-8.0.5.jar:na]

        at javafx.concurrent.Task$TaskCallable.call(Task.java:1423) [jfxrt.jar:na]

        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_92]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_92]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_92]

        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]

      Caused by: java.lang.NullPointerException: null

        at java.util.Objects.requireNonNull(Objects.java:203) ~[na:1.8.0_92]

        at java.util.Arrays$ArrayList.<init>(Arrays.java:3813) ~[na:1.8.0_92]

        at java.util.Arrays.asList(Arrays.java:3800) ~[na:1.8.0_92]

        at org.modeshape.jcr.spi.index.provider.IndexChangeAdapters$NodeTypesChangeAdapter.modifyProperties(IndexChangeAdapters.java:822) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.cache.change.ChangeSetAdapter.firePropertyChanges(ChangeSetAdapter.java:228) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.cache.change.ChangeSetAdapter.notify(ChangeSetAdapter.java:99) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.spi.index.provider.IndexProvider$AtomicIndex.notify(IndexProvider.java:1493) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.bus.RepositoryChangeBus.notify(RepositoryChangeBus.java:190) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.cache.document.WorkspaceCache.changed(WorkspaceCache.java:333) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.txn.SynchronizedTransactions.updateCache(SynchronizedTransactions.java:223) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:751) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        at org.modeshape.jcr.JcrSession.save(JcrSession.java:1171) ~[modeshape-jcr-4.6.0.Final.jar:4.6.0.Final]

        ... 16 common frames omitted

       

      This exception is due to an empty multi-value "jcr:mixinTypes" property in one of the copied nodes (this happened after removing a mixin from this node using removeMixin on this node). The call to getValuesAsArray on this property returns a null value which leads to this exception.

       

      Is this a bug that are should report in the issue tracker or there something invalid with the node graph that I am copying ? Is this allowed to have a zero-size jcr:mixinTypes property or should the removeMixin method have completely removed this property from the node ?

       

      Note : I'm using Modeshape 4.6.0.Final

       

      --

      Antoine