Uploaded image for project: 'Nuxeo Enhanced Viewer'
  1. Nuxeo Enhanced Viewer
  2. NEV-400

Fix NPE when last-modifier is not present in entity

    XMLWordPrintable

    Details

      Description

      Context

      The last-modifier field is used to track the last user which has edited the annotation.
      In a previous NEV version, this field was filled with the modification date, and so we now have code which checks this field in order to remove the data if it is a date.

      This check doesn't handle the nullity case which causes a NPE in the NEV connector causing the application to not display all annotations coming from Nuxeo.

      The NPE stack trace in an unit tests:

      com.arondor.viewer.annotation.exceptions.InvalidAnnotationFormatException: An error occurred during fetch of annotations
      
      	at com.nuxeo.ecm.arender.connector.BlobAnnotationAccessor.get(BlobAnnotationAccessor.java:234)
      	at com.nuxeo.ecm.arender.connector.TestBlobAnnotationAccessor.testGetOneAnnotationWithoutLastModifier(TestBlobAnnotationAccessor.java:130)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
      	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
      	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
      	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
      Caused by: java.lang.NullPointerException
      	at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
      	at java.util.regex.Matcher.reset(Matcher.java:309)
      	at java.util.regex.Matcher.<init>(Matcher.java:229)
      	at java.util.regex.Pattern.matcher(Pattern.java:1093)
      	at java.util.regex.Pattern.lambda$asPredicate$0(Pattern.java:5758)
      	at com.nuxeo.ecm.arender.connector.ComposablePredicate.test(ComposablePredicate.java:33)
      	at com.nuxeo.ecm.arender.connector.BlobAnnotationAccessor.deserializeAnnotation(BlobAnnotationAccessor.java:263)
      	at com.nuxeo.ecm.arender.connector.BlobAnnotationAccessor.convertFromNuxeo(BlobAnnotationAccessor.java:242)
      	at com.nuxeo.ecm.arender.connector.BlobAnnotationAccessor.lambda$get$0(BlobAnnotationAccessor.java:225)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      	at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742)
      	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
      	at com.nuxeo.ecm.arender.connector.BlobAnnotationAccessor.get(BlobAnnotationAccessor.java:223)
      	... 25 more
      

      Request

      We want to make this check robust against the nullity.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: