Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-16263

NullPointerException when updating an issue with setSkipScreenCheck(true), and particular combinations of fields present

      Issue Summary

      A NullPointerException (NPE) occurs when updating a Jira issue using IssueService with inputParameters.setSkipScreenCheck(true) if certain combinations of custom fields are present on the screen. This is particularly impactful for ScriptRunner (and its HAPI API), which defaults to skipping the screen check, but the issue can be reproduced without ScriptRunner as well. The problem appears to be triggered by a combination of custom fields—such as an Assets custom field and a Calculated Number field from the Jira Workflow Toolbox plugin—where one field requires additional parameters and another returns a null value in customFieldParams.getValuesForNullKey().
      ScriptRunner and other apps are affected.
      Regression observed in JSM 10.3.5 (not present in 10.2.0).
      Multiple apps and custom field types may be impacted.

      Steps to Reproduce

      Set up environment:

      1. Create a Jira Service Management (JSM) Data Center instance, version 10.3.5.
      2. Install the Jira Workflow Toolbox] app (ensure com.decadis.jira.xapps-library is also installed).
      3. Compile and install an app which exposes an REST API endpoint for testing with
        IssueInputParameters inputParameters = issueService.newIssueInputParameters();
                    inputParameters.setSkipScreenCheck(true);
      1. Create an Assets schema (e.g., based on the IT example) and an Assets custom field.
      2. Create a Calculated Number field (Jira Workflow Toolbox) with config: count(toStringList(% {issue.components})).
      1. Add both fields to the creation screen for a project and ensure both are visible.
      2. Create an issue (e.g., JRA-1) with both fields populated.
      3. Trigger the bug:

      Execute the following curl command to update the summary of the issue via the sample app's REST endpoint:

      curl -u admin:admin "http://localhost:8080/jsm/rest/myplugin/latest/myplugin/update-issue?issueKey=JRA-1"
      Observe the error in the logs.
      

      Expected Results

      The issue update should complete successfully, and the summary should be updated without any exceptions or errors.

      Actual Results

      The update fails, and a NullPointerException is logged. The stack trace points to JiraFieldParamHelper.convertToSimpleEntry and is caused by a null value in the collection being processed:

      java.lang.NullPointerException
          at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
          ...
          at com.atlassian.jira.web.action.issue.util.JiraFieldParamHelper.convertToSimpleEntry(JiraFieldParamHelper.java:92)
          ...
      
      • This behavior is not observed in JSM version 10.2.0; it appears to be a regression in 10.3.5.
      • The issue is likely related to changes in Jira's handling of custom field parameters and may affect multiple apps that implement custom fields.

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available.

      Versions Tested

      Please confirm all versions that have been tested for this issue, and indicate whether the tested version is affected or not affected, below: 

      Testing Requirements Version Affected Version
      Customers Reported Version 10.3.5 Yes
      Most Recent Bug-Fix Release    
      Previous Major Release    
      Most Recent LTS    
      Previous Supported LTS    
      Other Versions.. 10.2.0 No
      (Add rows as needed)    

              jxu2@atlassian.com Sam Xu
              71f1dad54ffe Wagner M.
              Affected customers:
              11 This affects my team
              Watchers:
              12 Start watching this issue

                Created:
                Updated:
                Resolved: