Uploaded image for project: 'XNAT'
  1. XNAT
  2. XNAT-6853

Snapshot generator throws NPE for DICOM that doesn't contain instance number

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 1.8.3
    • None
    • None
    • XNAT 2021-Q4 Sprint 2
    • Rank:
      0|0hzycd:zzzr07zzzzxzi
    • XNAT 2021-Q4 Sprint 2

    Description

      I found a number of errors in the snapshot logs from CNDA with the following stacktrace:

      2021-06-24 09:38:38,658 [http-bio-8080-exec-209] WARN  org.nrg.xnat.snapshot.services.impl.SnapshotGenerationServiceImpl - Exception from snapshot-provider pool
      java.lang.NullPointerException: null
      	at java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469)
      	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
      	at java.util.TimSort.sort(TimSort.java:220)
      	at java.util.Arrays.sort(Arrays.java:1512)
      	at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:353)
      	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
      	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:566)
      	at org.nrg.xnat.snapshot.generator.impl.SnapshotResourceGeneratorImpl.init(SnapshotResourceGeneratorImpl.java:205)
      	at org.nrg.xnat.snapshot.generator.impl.SnapshotResourceGeneratorImpl.initGenerator(SnapshotResourceGeneratorImpl.java:160)
      	at org.nrg.xnat.snapshot.generator.impl.SnapshotResourceGeneratorImpl.isUnsnapshottable(SnapshotResourceGeneratorImpl.java:98)
      	at org.nrg.xnat.snapshot.generator.impl.SnapshotResourceGeneratorImpl.createSnapshot(SnapshotResourceGeneratorImpl.java:53)
      	at org.nrg.xnat.snapshot.services.impl.SnapshotProvider.createSnapshot(SnapshotProvider.java:89)
      	at org.nrg.xnat.snapshot.services.impl.SnapshotProvider.provideSnapshotOrThumbnail(SnapshotProvider.java:75)
      	at org.nrg.xnat.snapshot.services.impl.SnapshotGenerationServiceImpl.provideSnapshotOrThumbnail(SnapshotGenerationServiceImpl.java:62)
      	at org.nrg.xnat.snapshot.services.impl.SnapshotGenerationServiceImpl.getSnapshot(SnapshotGenerationServiceImpl.java:32)
      	at org.nrg.xnat.snapshot.rest.SnapshotGenerationApi.getSnapshotFile(SnapshotGenerationApi.java:105)
      	at org.nrg.xnat.snapshot.rest.SnapshotGenerationApi.getSnapshot(SnapshotGenerationApi.java:66)
      	at org.nrg.xnat.snapshot.rest.SnapshotGenerationApi$$FastClassBySpringCGLIB$$ca28599e.invoke(<generated>)
      	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      

      The code there is the following:

      final List<String> files = CatalogUtils.getEntriesByFilter(catalog, CatDcmentryBean.class::isInstance)
                                             .stream()
                                             .map(CatDcmentryBean.class::cast)
                                             .sorted(Comparator.comparing(CatDcmentryBean::getInstancenumber))
                                             .map(e -> (new File(dicomRootPath.toString(), e.getUri())).getAbsolutePath())
                                             .collect(Collectors.toList());
      

      Given that the error is in the comparator and the comparator is based on the instance number, it's a fair presumption that the root cause is an empty/null instance number.

      Attachments

        Issue Links

          Activity

            People

              moore.stephen.m@wustl.edu Steve Moore
              jrherrick@wustl.edu Rick Herrick
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: