Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-5451

Calculating licenses for users with empty external ids fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • Centralized License Visibility 1.0.5, Centralized License Visibility 1.1.0, Centralized License Visibility 1.1.1
    • None
    • None

    Description

      Issue Summary

      When calculating license usage for users that have empty external ids the calculation will fail on the application's side with a NullPointerException.

      This can typically happen in directories with a nullable external id attribute by definition or when the external id attribute was misconfigured. Internal directories generally should not be affected by this issue as default external ids are generated for those directories.

      While Crowd does augment external ids provided to applications, it will relay a null or empty external id as a null, so the issue can occur both when the directory is defined in Jira/Confluence/BBS as well as when it's a directory defined in the Crowd defined for that application.

       

      Steps to Reproduce

      1. Setup a directory which has at least one user with an empty external id in Jira/Confluence/BBS
      2. Setup license monitoring for that application

      Expected Results

      The license usage is calculated.

      Actual Results

      License calculation fails on the connected application's side with an exception like this one:

      2019-08-21 17:18:20,008 ERROR [Caesium-1-1] [impl.schedule.caesium.JobRunnerWrapper] runJob Scheduled job COLLECT-LICENSE-USAGE#PanopticonCollectLicenseUsageData failed to run java.lang.NullPointerException: externalId is marked @NonNull but is null at com.atlassian.plugins.license.model.PluginLicensedUser$PluginLicensedUserBuilder.externalId(PluginLicensedUser.java:11) at com.atlassian.plugins.license.service.AbstractLicenseUsageCollector.populateLicensedUserIdentity(AbstractLicenseUsageCollector.java:231) at com.atlassian.plugins.license.service.ConfluenceLicenseUsageCollector.getLicensedUser(ConfluenceLicenseUsageCollector.java:82) at com.atlassian.plugins.license.service.ConfluenceLicenseUsageCollector.lambda$getLicensedUsers$1(ConfluenceLicenseUsageCollector.java:58) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) 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 com.atlassian.plugins.license.service.ConfluenceLicenseUsageCollector.getLicensedUsers(ConfluenceLicenseUsageCollector.java:61) at com.atlassian.plugins.license.service.ConfluenceLicenseUsageCollector.lambda$getLicensedUsersProvider$0(ConfluenceLicenseUsageCollector.java:52) 
      

      Workaround

      If the users are not necessary in the application, they can be removed either manually or by configuring the directory in a way that would filter them out. If they are necessary and the directory is external then check if the attribute used for external id is non-nullable and unique within that directory. While the issue generally should not occur for internal directories the external_id column in the cwd_user table could be populated manually for those users.

      Attachments

        Issue Links

          Activity

            People

              moles Marcin Oles
              ppetrowski Patryk
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: