Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-60080

Permission Scheme 500 Error and Nullpointerexception

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      Summary

      If a user is created and added to a permission scheme, and then the user is later deleted (not deactivated), if the user still remains in the permission scheme before they are deleted, the permission scheme will show as a blank screen, the browser will throw a 500 error in the browser console, and the NPE will appear in the log file (shown below).

      Steps to Reproduce

      1. Create a user in User Management.
      2. Navigate to Issues > Permission Schemes.
      3. Add the user you created to any permission in a permission scheme of your choice.
      4. After the permission has been granted, delete that new user in User Management.
      5. Navigate to Issues > Permission Schemes and select the permission scheme you used in step 3. The scheme will not load.

      Expected Results

      The permission scheme should load and you should be able to edit the permissions.

      Actual Results

      The below exception is thrown in the JIRA log file, and the permission scheme will not load in the browser:

      2016-03-04 15:02:33.588560500 2016-03-04 15:02:33,584 http-nio-2998-exec-555 ERROR sysadmin 902x172511x1 jvz64d 4.15.43.214,10.84.193.150,127.0.0.1 /rest/internal/2/managedpermissionscheme/10600 [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: null
      2016-03-04 15:02:33.588563500 java.lang.NullPointerException
      2016-03-04 15:02:33.588563500 	at com.atlassian.jira.permission.DefaultPermissionSchemeService.updateSchemeToReturnUsername(DefaultPermissionSchemeService.java:436)
      2016-03-04 15:02:33.588564500 	at com.atlassian.jira.permission.DefaultPermissionSchemeService.access$2200(DefaultPermissionSchemeService.java:58)
      2016-03-04 15:02:33.588611500 	at com.atlassian.jira.permission.DefaultPermissionSchemeService$13.apply(DefaultPermissionSchemeService.java:331)
      2016-03-04 15:02:33.588612500 	at com.atlassian.jira.permission.DefaultPermissionSchemeService$13.apply(DefaultPermissionSchemeService.java:327)
      2016-03-04 15:02:33.588613500 	at com.atlassian.fugue.Option$Some.fold(Option.java:421)
      2016-03-04 15:02:33.588613500 	at com.atlassian.fugue.Option.flatMap(Option.java:287)
      2016-03-04 15:02:33.588621500 	at com.atlassian.jira.permission.DefaultPermissionSchemeService.getScheme(DefaultPermissionSchemeService.java:327)
      2016-03-04 15:02:33.588622500 	at com.atlassian.jira.permission.DefaultPermissionSchemeService.getPermissionScheme(DefaultPermissionSchemeService.java:105)
      2016-03-04 15:02:33.588630500 	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.getManagedPermissionScheme(ManagedPermissionSchemeHelperImpl.java:92)
      2016-03-04 15:02:33.588631500 	... 2 filtered
      2016-03-04 15:02:33.588631500 	at java.lang.reflect.Method.invoke(Method.java:497)
      2016-03-04 15:02:33.588632500 	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
      2016-03-04 15:02:33.588638500 	at com.sun.proxy.$Proxy550.getManagedPermissionScheme(Unknown Source)
      2016-03-04 15:02:33.588639500 	... 2 filtered
      

      Workaround

      The value (user or group) needs to be removed from the scheme in the database. Use the following steps:

      1. Find the permission scheme ID (it will either be in the URL, or in the stack trace. In this case, you can see in the log file that it is '10600'. This value will be used in this example;
      2. Access JIRA's database;
      3. Run the below query to find invalid user entries on the permission scheme;
        SELECT * FROM schemepermissions WHERE perm_type = 'user' AND perm_parameter NOT IN (
        	SELECT lower_user_name FROM cwd_user WHERE directory_id IN (
        		SELECT id FROM cwd_directory));
        
      4. Delete those entries directly through the database;
      5. Restart JIRA;

      This will remove that user from all permission schemes they are associated with.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              efranklin Eric Franklin (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: