Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-66616

Null Pointer Exception when Assignee is being cleared in a post function workflow transition.

    XMLWordPrintable

Details

    Description

      This has been found by debugging this support issue: https://support.atlassian.com/browse/JST-60124

      When there is a post function to clear an assignee in a workflow transition we get the error: "Unable to purge contents of field - assignee - Assignee"

      In the logs we get this exception:

      400000005151195714bf5cfc 2013-03-25 20:43:09,342 TP-Processor11 ERROR sysadmin 1243x1909x1 1wub7ek 59.167.133.100,131.103.26.225 /secure/CommentAssignIssue.jspa [jsu.workflow.function.ClearFieldValuePostFunction] Unable to purge contents of field - assignee - Assignee
      @400000005151195714bf64cc java.lang.NullPointerException
      @400000005151195714bf68b4 	at com.googlecode.jsu.util.WorkflowUtils.convertApplicationUserToCrowdEmbeddedUser(WorkflowUtils.java:887)
      @400000005151195714bf68b4 	at com.googlecode.jsu.util.WorkflowUtils.setFieldValue(WorkflowUtils.java:654)
      @400000005151195714bf9794 	at com.googlecode.jsu.util.WorkflowUtils.setFieldValue(WorkflowUtils.java:926)
      @400000005151195714bf9b7c 	at com.googlecode.jsu.workflow.function.ClearFieldValuePostFunction.executeFunction(ClearFieldValuePostFunction.java:58)
      @400000005151195714bf9f64 	at com.googlecode.jsu.workflow.function.AbstractPreserveChangesPostFunction.execute(AbstractPreserveChangesPostFunction.java:59)
      @400000005151195714bfab1c 	at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050)
      @400000005151195714bfab1c 	at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446)
      @400000005151195714bfaf04 	at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:564)
      @400000005151195714bfbea4 	at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:955)
      @400000005151195714bfc28c 	at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:910)
      @400000005151195714bfc674 	at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:451)
      @400000005151195714bfca5c 	at com.atlassian.jira.web.action.issue.CommentAssignIssue.doExecute(CommentAssignIssue.java:196)
      ...
      

      Instance Bug Reproduced on

      https://clone-pocketgems.atlassian.net/
      Talk to Support about getting sysadmin password

      Culprit Files

      Cause of Bug

      In function ClearFieldValuePostFunction.executeFunction we call the workflowUtils.setFieldValue function with parameter 'value' = null as seen on line 58.

      On line 655 of WorkflowUtil we call User user = convertApplicationUserToCrowdEmbeddedUser(convertValueToUser(value));

      convertValueToUser(null) returns null so null is passed to convertApplicationUserToCrowdEmbeddedUser found on line 886. here the parameter calles .getUsername but as it is null a null pointer exception is made. This change was added in the commit provided above.

      Possible solution

      Null pointer check in convertApplicationUserToCrowdEmbeddedUser function.

      Workaround

      Instead of using the Clear Post Function the Update Issue Field Function should be used instead where the field value is 'Unassigned', see attached screenshot.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jashmore jashmore@atlassian.com (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: