Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5110

encounter.getProvidersByRoles throws NPE where a provider does not have a role.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Change Request Cancelled
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      Please find the unit test here.
      https://github.com/pushpa446/openmrs-core/commit/f49b388c96a285080e62e3ea2e0088874f3db461.

      Collectors.groupingby does not allow null as a key value.

      Here is the full stack trace:
      java.lang.NullPointerException: element cannot be mapped to a null key

      at java.util.Objects.requireNonNull(Objects.java:228)
      at java.util.stream.Collectors.lambda$groupingBy$45(Collectors.java:907)
      at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
      at java.util.Iterator.forEachRemaining(Iterator.java:116)
      at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pushpa446 pushpalatha d
                Reporter:
                pushpa446 pushpalatha d
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: