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

Issue creation or Assets custom field updates will fail with NullPointerException if Assets field includes request's issue type in its context

      Issue Summary

      While trying to submit a new issue using the mail handler (Email Channel) or update an Assets custom field via Automation or perform a bulk edit, this action will fail with NullPointerException in case the Assets field includes the request's issue type in its context (or if the Assets field has a global context).

      Steps to Reproduce

      1. Create a JSM project that utilizes Assets custom fields.
      2. Create a new request type. Optionally you could add the Assets field to the creation form.
      3. Make sure that the Assets field context includes the issue type of the JSM request.
      4. Configure the Email Channel to create new issues of the configured request type with the help of email messages.
      5. Try to create a new issue by sending an email to the email channel's address. This action will fail with an exception.
      6. At the same time, the creation of the same issue through the portal or Jira UI will be completed successfully.

      Expected Results

      The issue will be successfully created

      Actual Results

      • While trying to create a new issue from email, the mail handler will fail to do this and the following exception will be thrown at atlassian-jira.log;
      2024-06-27 09:52:42,776+0000 Caesium-1-1 ERROR admin     [c.a.p.i.util.runner.AuthenticationContextUtilImpl] Unexpected error while running action as user 'admin'
      java.lang.NullPointerException: Cannot invoke "javax.servlet.http.HttpServletRequest.getParameterMap()" because the return value of "com.atlassian.jira.web.ExecutingHttpRequest.get()" is null
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getIssueIdFromRequestContext(DefaultObjectCustomField.java:664)
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getIssueIdFromParamsOrContext(DefaultObjectCustomField.java:660)
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.validateFromParams(DefaultObjectCustomField.java:584)
      	at com.atlassian.jira.issue.fields.ImmutableCustomField.validateParams(ImmutableCustomField.java:713)
      	at com.atlassian.servicedesk.internal.feature.customer.request.data.validation.VisibleFieldValidator.performFieldValidationInJira(VisibleFieldValidator.java:112)
      ...
      
      • A similar exception might be also triggered while trying to set the value for this Asset field using Automation for Jira:
      2024-06-26 07:31:21,448+0200 automation-rule-executor:thread-3 ERROR <a4j_user>     [c.c.a.r.j.action.edit.EditIssueActionExecutor] Unexpected error editing issue: 
      java.lang.NullPointerException: Cannot invoke "javax.servlet.http.HttpServletRequest.getParameterMap()" because the return value of "com.atlassian.jira.web.ExecutingHttpRequest.get()" is null
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getStringListMapFromRequestContext(DefaultObjectCustomField.java:837)
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getcustomFieldScopedIql(DefaultObjectCustomField.java:848)
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.isValidObjectBeanScope(DefaultObjectCustomField.java:928)
      
      • A similar Error is also observed when creating issues via "External System import" where the "csv file" to be imported has "Asset Custom Field"
      2024-07-22T19:34:48,384 INFO - Importing issue: [externalId='autoid-8287103338540152504', summary='External System Import Test']
      2024-07-22T19:34:48,408 WARN - Cannot add value [ [CFB-34306] ] to CustomField Asset Object CF in Issue with summary 'External System Import Test'. Exception Message: null
      java.lang.NullPointerException: null
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getIssueIdFromRequestContext(DefaultObjectCustomField.java:664) ~[?:?]
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getIssueIdFromParamsOrContext(DefaultObjectCustomField.java:660) ~[?:?]
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getValueFromCustomFieldParams(DefaultObjectCustomField.java:719) ~[?:?]
      	at com.riadalabs.jira.plugins.insight.services.jira.customfield.DefaultObjectCustomField.getValueFromCustomFieldParams(DefaultObjectCustomField.java:98) ~[?:?]
      

      Note about this bug

      Due to this bug, Automation Rules involving Assets might fail to complete due to the same error, as shown in the Rule Audit Logs:

      Workaround

      So far, the only workaround that prevents the problem would be limiting the context of Assets to exclude the request's issue types from its scope. Other workarounds will be added here when available

        1. AutomationRuleFailure.png
          145 kB
          Julien Rey
        2. exclude_issue_from_cf_contextpng.png
          86 kB
          Alexander Artemenko
        3. mail_log.png
          175 kB
          Alexander Artemenko
        4. request_config.jpeg
          548 kB
          Alexander Artemenko

          Form Name

            [JSDSERVER-15411] Issue creation or Assets custom field updates will fail with NullPointerException if Assets field includes request's issue type in its context

            No work has yet been logged on this issue.

              jxu2@atlassian.com Sam Xu
              e7e12f16f891 Alexander Artemenko
              Affected customers:
              8 This affects my team
              Watchers:
              18 Start watching this issue

                Created:
                Updated:
                Resolved: