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

Associating the Default workflow scheme causes a null pointer exception when the project's workflow scheme is called from the REST API in Jira 10 and above

XMLWordPrintable

      Issue Summary

      Associating the Default workflow scheme causes a null pointer exception when the project's workflow scheme is called from the REST API in Jira version 10 and above

      Steps to Reproduce

      1. Associate the Default workflow scheme to a project
      2. Call /rest/api/2/project/(projectID)/workflowscheme

      Expected Results

      /rest/api/2/project/(projectID)/workflowscheme returns a value successfully

      Actual Results

      /rest/api/2/project/(projectID)/workflowscheme returns an error message

      The below exception is thrown in the xxxxxxx.log file:

      /rest/api/2/project/(projectID)/workflowscheme [c.a.p.r.v2.exception.ThrowableExceptionMapper] Uncaught exception 0cbc3013-7621-43d2-aa43-eff87c19fd21 thrown by REST service: Cannot invoke "java.lang.Long.longValue()" because the return value of "com.atlassian.jira.workflow.AssignableWorkflowScheme.getId()" is null
      java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "com.atlassian.jira.workflow.AssignableWorkflowScheme.getId()" is null
              at com.atlassian.jira.rest.v2.admin.workflowscheme.WorkflowSchemeBeanFactory.getUrlForParent(WorkflowSchemeBeanFactory.java:161)
              at com.atlassian.jira.rest.v2.admin.workflowscheme.WorkflowSchemeBeanFactory.asBean(WorkflowSchemeBeanFactory.java:89)
              at com.atlassian.jira.rest.v2.admin.workflowscheme.ProjectWorkflowSchemeResource.getWorkflowSchemeForProject(ProjectWorkflowSchemeResource.java:106)
              at jdk.internal.reflect.GeneratedMethodAccessor15793.invoke(Unknown Source)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:569)
      

      Workaround

      • Jira ships with another default workflow scheme called "classic" which you can use instead of Default
      • If the classic workflow scheme has been deleted you can create a new workflow scheme and associate all issue types to the default Jira workflow, re-creating the classic/default workflow scheme

      Notes
      This is not reproducible in Jira 9.12- even though the underlying database entires are null when using the Default workflow scheme:

      jira912=# SELECT p.id AS project_id,                                                                                                                                                                                                  p.pkey AS project_key,                                                                                                                                                                                                                p.pname AS project_name,                                                                                                                                                                                                              ws.name AS workflow_scheme_name,                                                                                                                                                                                                      ws.id as workflow_scheme_id,                                                                                                                                                                                                          wse.workflow AS workflow_name,                                                                                                                                                                                                        w.id AS workflow_id                                                                                                                                                                                                                   FROM project p                                                                                                                                                                                                                        LEFT OUTER JOIN nodeassociation na ON na.source_node_id = p.id AND na.sink_node_entity = 'WorkflowScheme'                                                                                                                             LEFT OUTER JOIN workflowscheme ws ON ws.id = na.sink_node_id                                                                                                                                                                          LEFT OUTER JOIN workflowschemeentity wse ON wse.scheme = ws.id                                                                                                                                                                        LEFT OUTER JOIN jiraworkflows w ON wse.workflow = w.workflowname                                                                                                                                                                      where p.id = '12401'                                                                                                                                                                                                                  ORDER BY p.pkey;
       project_id | project_key | project_name | workflow_scheme_name | workflow_scheme_id | workflow_name | workflow_id 
      ------------+-------------+--------------+----------------------+--------------------+---------------+-------------
            12401 | BAS         | basic        |                      |                    |               |            
      

      the REST API returns the following:

      {"name":"Default Workflow Scheme","description":"This is the default Workflow Scheme. Any new projects that are created will be assigned this scheme.","defaultWorkflow":"jira","issueTypeMappings":{},"draft":false,"self":"http://jira/rest/api/2/workflowscheme/null","issueTypes":{"10300":{"self":"http://jira/rest/api/2/issuetype/10300","id":"10300","description":"For system outages or incidents. Created by Jira Service Management.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10700&avatarType=issuetype","name":"Incident","subtask":false,"avatarId":10700},"10501":{"self":"http://jira/rest/api/2/issuetype/10501","id":"10501","description":"A new feature of the product, which has yet to be developed.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10311&avatarType=issuetype","name":"New Feature","subtask":false,"avatarId":10311},"10002":{"self":"http://jira/rest/api/2/issuetype/10002","id":"10002","description":"A task that needs to be done.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10318&avatarType=issuetype","name":"Task","subtask":false,"avatarId":10318},"10500":{"self":"http://jira/rest/api/2/issuetype/10500","id":"10500","description":"An improvement or enhancement to an existing feature or task.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10310&avatarType=issuetype","name":"Improvement","subtask":false,"avatarId":10310},"10004":{"self":"http://jira/rest/api/2/issuetype/10004","id":"10004","description":"A problem which impairs or prevents the functions of the product.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10303&avatarType=issuetype","name":"Bug","subtask":false,"avatarId":10303},"10304":{"self":"http://jira/rest/api/2/issuetype/10304","id":"10304","description":"Track underlying causes of incidents. Created by Jira Service Management.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10704&avatarType=issuetype","name":"Problem","subtask":false,"avatarId":10704},"10303":{"self":"http://jira/rest/api/2/issuetype/10303","id":"10303","description":"Created by Jira Service Management.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10703&avatarType=issuetype","name":"Change","subtask":false,"avatarId":10703},"10302":{"self":"http://jira/rest/api/2/issuetype/10302","id":"10302","description":"For requests that require approval. Created by Jira Service Management","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10702&avatarType=issuetype","name":"Service Request with Approvals","subtask":false,"avatarId":10702},"10301":{"self":"http://jira/rest/api/2/issuetype/10301","id":"10301","description":"Created by Jira Service Management.","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10701&avatarType=issuetype","name":"Service Request","subtask":false,"avatarId":10701},"10105":{"self":"http://jira/rest/api/2/issuetype/10105","id":"10105","description":"Autogenerated subtask type","iconUrl":"http://jira/images/icons/issue_subtask.gif","name":"SubtaskType2","subtask":true},"10106":{"self":"http://jira/rest/api/2/issuetype/10106","id":"10106","description":"Autogenerated subtask type","iconUrl":"http://jira/images/icons/issue_subtask.gif","name":"SubtaskType3","subtask":true},"10003":{"self":"http://jira/rest/api/2/issuetype/10003","id":"10003","description":"The sub-task of the issue","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10316&avatarType=issuetype","name":"Sub-task","subtask":true,"avatarId":10316},"10104":{"self":"http://jira/rest/api/2/issuetype/10104","id":"10104","description":"","iconUrl":"http://jira/images/icons/sales.gif","name":"IssueType 5","subtask":false},"10103":{"self":"http://jira/rest/api/2/issuetype/10103","id":"10103","description":"","iconUrl":"http://jira/images/icons/bug.gif","name":"IssueType 4","subtask":false},"10102":{"self":"http://jira/rest/api/2/issuetype/10102","id":"10102","description":"","iconUrl":"http://jira/images/icons/improvement.gif","name":"IssueType 3","subtask":false},"10101":{"self":"http://jira/rest/api/2/issuetype/10101","id":"10101","description":"","iconUrl":"http://jira/images/icons/sales.gif","name":"IssueType 2","subtask":false},"10100":{"self":"http://jira/rest/api/2/issuetype/10100","id":"10100","description":"","iconUrl":"http://jira/images/icons/exclamation.gif","name":"IssueType 1","subtask":false},"10400":{"self":"http://jira/rest/api/2/issuetype/10400","id":"10400","description":"","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10300&avatarType=issuetype","name":"Goal","subtask":false,"avatarId":10300},"10000":{"self":"http://jira/rest/api/2/issuetype/10000","id":"10000","description":"Created by Jira Software - do not edit or delete. Issue type for a big user story that needs to be broken down.","iconUrl":"http://jira/images/icons/issuetypes/epic.svg","name":"Epic","subtask":false},"10001":{"self":"http://jira/rest/api/2/issuetype/10001","id":"10001","description":"Created by Jira Software - do not edit or delete. Issue type for a user story.","iconUrl":"http://jira/images/icons/issuetypes/story.svg","name":"Story","subtask":false},"10200":{"self":"http://jira/rest/api/2/issuetype/10200","id":"10200","description":"","iconUrl":"http://jira/secure/viewavatar?size=xsmall&avatarId=10300&avatarType=issuetype","name":"Initiative ","subtask":false,"avatarId":10300}}}
      

              Unassigned Unassigned
              jcurry Jeff Curry
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: