Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-18751

NullPointerException in Global Permission or any other New UI in Permission settings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 6.2.2
    • 6.2.1
    • Permissions
    • None

    Description

      Summary

      Accessing the Global Permission page has NullPointerException if there is a group (that have been deleted) in the permission database

      Steps to Reproduce

      1. Create a group "testgroup" in Crowd
      2. Configure Bamboo to use Crowd for User Management
      3. Add this group "testgroup" into Bamboo Global Permission
      4. Delete this group "testgroup" in Crowd
      5. Restart Bamboo (or remove Crowd User Management in Bamboo and re-add it) to clear the cache
      6. Access the Global Permission page

      Expected Results

      It should work fine without error

      Actual Results

      There is nothing display in the Group list and a popup window with NullPointerException appear
      The below exception is thrown in the atlassian-bamboo.log file:

      2017-10-13 21:03:26,481 INFO [http-nio-8085-exec-14] [AccessLogFilter] kahloun.foong GET http://localhost:8085/rest/api/latest/permissions/global/roles?limit=30&start=0&name=&_=1507899806215 602378kb
      2017-10-13 21:03:26,483 WARN [http-nio-8085-exec-13] [BambooRuntimeExceptionMapper] Unexpected error from REST call
      java.lang.NullPointerException
      	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.ArrayList.sort(ArrayList.java:1454)
      	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:387)
      	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      	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.bamboo.plugins.rest.permission.BasicPermissionResource.listGroupPermissions(BasicPermissionResource.java:119)
      	at com.atlassian.bamboo.plugins.rest.permission.GlobalPermissionsResource.listGroupPermissions(GlobalPermissionsResource.java:164)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$TypeOutInvoker$1.invoke(DispatchProviderHelper.java:169)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:83)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
      	at com.atlassian.plugins.rest.common.expand.interceptor.ExpandInterceptor.intercept(ExpandInterceptor.java:34)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.invokeMethodWithInterceptors(DispatchProviderHelper.java:110)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$TypeOutInvoker._dispatch(DispatchProviderHelper.java:167)
      	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      

      Notes

      • The database table ACL_ENTRY still contain the group "testgroup"
      • The following query return the list of group in the Global Permission
        SELECT ID,SID 
        FROM ACL_ENTRY
        WHERE ACL_OBJECT_IDENTITY = 
        (SELECT ID FROM ACL_OBJECT_IDENTITY 
        WHERE OBJECT_ID_CLASS = 'com.atlassian.bamboo.security.GlobalApplicationSecureObject')
        AND TYPE = 'GROUP_PRINCIPAL';
        
      • This problem happens to other Permission settings too

      Workaround

      1. Run the following SQL query:
        SELECT DISTINCT(SID) 
        FROM ACL_ENTRY;
        
      2. Compare it with the group list in Administration >> Security >> Groups
      3. Shutdown Bamboo
      4. Backup database for rollback purposes
      5. Delete the group data in the table ACL_ENTRY for the group that does not exist anymore, for example:
        DELETE FROM ACL_ENTRY
        WHERE SID='xxx' AND TYPE = 'GROUP_PRINCIPAL';
        

        Replace xxx with the problematic group that does not exist anymore

      6. Restart Bamboo

      Attachments

        Issue Links

          Activity

            People

              mgardias Marcin Gardias
              klfoong Foong (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: