Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-12780

Backport OPENIDM-12353: Processing an array attribute containing null element results in null pointer exception

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • OpenIDM 6.0.0, 6.5.0
    • 6.5.0.2
    • None

    Description

      To reproduce:

      1. Create a property in managed/user schema, set type to array, set item type to string, allowing null. For example:

                          "history" : {
                              "title" : "History",
                              "type" : "array",
                              "viewable" : true,
                              "searchable" : false,
                              "userEditable" : true,
                              "items" : {
                                  "type" : ["string","null"]
                              }
                          }
      

      2. Create a new user with the history attribute set to [null, "event 1"], it returns a 500 error. But the user is created in repo.

      | 24300 |              5 | 53eb2485-4766-40eb-9120-35448c0abf29 | 0   | {"userName":"test10","givenName":"test10","sn":"user","mail":"test10@example.com","preferences":{"updates":false,"marketing":false},"history":[null,"event 1"],"accountStatus":"active","effectiveRoles":[],"effectiveAssignments":[],"_id":"53eb2485-4766-40eb-9120-35448c0abf29","_rev":"0"} 
      

      3. Any REST GET involving the user returns a 500 error, with the following exception in logs

      Jan 10, 2019 3:16:08.756 PM org.forgerock.openidm.managed.filtering.ContentFilteringSupport processField
      FINEST: Processing field: [ null, "event 1" ], pointer: /history
      Jan 10, 2019 3:16:08.758 PM org.forgerock.openidm.managed.filtering.ContentFilteringSupport lambda$isIncluded$5
      FINEST: Include: /*, matching: true, default: true, private returned: true
      Jan 10, 2019 3:16:08.759 PM org.forgerock.openidm.managed.filtering.ContentFilteringSupport processCollectionField
      FINEST: Processing collection field: [ null, "event 1" ]
      ...
      Caused by: java.lang.NullPointerException
              at java.util.Objects.requireNonNull(Objects.java:203)
              at java.util.Optional.<init>(Optional.java:96)
              at java.util.Optional.of(Optional.java:108)
              at org.forgerock.openidm.managed.filtering.ContentFilteringSupport.lambda$processCollectionField$4(ContentFilteringSupport.java:191)
              at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
              at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
              at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
              at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
              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.forgerock.openidm.managed.filtering.ContentFilteringSupport.processCollectionField(ContentFilteringSupport.java:194)
              at org.forgerock.openidm.managed.filtering.ContentFilteringSupport.processField(ContentFilteringSupport.java:134)
              at org.forgerock.openidm.managed.filtering.ContentFilteringSupport.filter(ContentFilteringSupport.java:83)
              at org.forgerock.openidm.managed.ManagedObjectSet.prepareResponse(ManagedObjectSet.java:1729)
              at org.forgerock.openidm.managed.ManagedObjectSet.createInstance(ManagedObjectSet.java:931)
              ... 115 more
      

      Attachments

        Issue Links

          Activity

            People

              patrickdiligent patrick diligent
              mark.offutt Mark Offutt [X] (Inactive)
              Michal Orlik Michal Orlik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: