Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25552

Open a system session without originatingUsername is logging NPE

    XMLWordPrintable

    Details

      Description

      The method `openSystemSession` of the `AbstractWork` class is a shorcut to the method `CoreInstance.openCoreSessionSystem(null, null)`. But if the second parameter (originatingUsername) is not filled, its throws a NullPointerException (see stack below) during the documents saving (contributor = null).

      A possible fix could be adding a 'isNotBlank' check here:
      https://github.com/nuxeo/nuxeo/blob/master/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/CoreInstance.java#L113

      2018-08-08 14:54:03,965 ERROR [EventServiceImpl] Exception during dclistener sync listener execution, continuing to run other listeners
      java.lang.NullPointerException
      	at org.nuxeo.ecm.platform.dublincore.service.DublinCoreStorageService.stripPrincipalPrefix(DublinCoreStorageService.java:119)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at org.nuxeo.ecm.platform.dublincore.service.DublinCoreStorageService.getSanitizedExistingContributors(DublinCoreStorageService.java:115)
      	at org.nuxeo.ecm.platform.dublincore.service.DublinCoreStorageService.addContributor(DublinCoreStorageService.java:89)
      	at org.nuxeo.ecm.platform.dublincore.listener.DublinCoreListener.handleEvent(DublinCoreListener.java:147)
      	at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:243)
      	at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:271)
      	at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:733)
      	at com.santander.nuxeo.services.ImporterServiceImpl.createBatch(ImporterServiceImpl.java:153)
      	at com.santander.nuxeo.services.ImporterServiceImpl.scanBatchFolder(ImporterServiceImpl.java:128)
      	at com.santander.nuxeo.works.ScanBatchFolderWork.work(ScanBatchFolderWork.java:46)
      	at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:435)
      	at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:355)
      	at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:57)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h