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

Fix potential NPE with the "favorites" enricher

    XMLWordPrintable

    Details

    • Release Notes Summary:
      Collections can be used even if user does not have Favorites.
    • Tags:
    • Backlog priority:
      750
    • Sprint:
      nxfit 11.1.9
    • Story Points:
      3

      Description

      This bug cannot be reproduced with a bare Nuxeo Platform because it requires an instance without a Domain document.

      This NPE occurs when the Favorites collection does not exist. How?
      The Favorites collection is created in the user personal workspace, which is created in the user workspace root which is created under the first created Domain document.

      => if there is no Domain found by this query, none of the previous document will be created. Hence the NPE when reading collection.getId() on this line.

       Here is the corresponding stacktrace on 9.10

      ERROR [http-nio-0.0.0.0-8080-exec-15] [org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoRequestControllerFilter] remote=0:0:0:0:0:0:0:1,principal=xxx,uri=/nuxeo/site/api/v1/path/document,session=D8E8FDC944654263AB62F79CA561DA4B.nuxeo,thread=http-nio-0.0.0.0-8080-exec-15,info=Unhandled error was caught by the Filter
      java.lang.NullPointerException
      	at org.nuxeo.ecm.collections.core.CollectionManagerImpl.isInCollection(CollectionManagerImpl.java:288)
      	at org.nuxeo.ecm.collections.core.FavoritesManagerImpl.isFavorite(FavoritesManagerImpl.java:108)
      	at org.nuxeo.ecm.collections.core.io.FavoritesJsonEnricher.write(FavoritesJsonEnricher.java:57)
      	at org.nuxeo.ecm.collections.core.io.FavoritesJsonEnricher.write(FavoritesJsonEnricher.java:40)
      	at org.nuxeo.ecm.core.io.marshallers.json.enrichers.AbstractJsonEnricher.write(AbstractJsonEnricher.java:54)
      	at org.nuxeo.ecm.core.io.marshallers.json.enrichers.AbstractJsonEnricher.write(AbstractJsonEnricher.java:37)
      	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter.write(AbstractJsonWriter.java:76)
      	at org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter.write(ExtensibleEntityJsonWriter.java:99)
      	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter.write(AbstractJsonWriter.java:76)
      	at org.nuxeo.ecm.webengine.jaxrs.coreiodelegate.PartialCoreIODelegate.writeTo(PartialCoreIODelegate.java:119)
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 6 hours
                6h