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

Jira Toolkit AuthorOfLastUpdateOrCommentCFType does not handle renamed usernames

      Summary of Issue

      When a User has been previously renamed, if that user sends in an Email (with CC participants) to the Jira Service Desk handler, the Jira Service Desk Handler will create the ticket but not add the participants due to what appears like the Jira Toolkit AuthorOfLastUpdateOrCommentCFType not obtaining the correctly mapped field in app_user.

      How to reproduce

      1. Install JIRA Service Desk
        • Create a new user on setup with email address admin@mydomain.com
      2. Through Jira Administration » Add-ons » Find new add-ons
        • Install Jira Toolkit
      3. Navigate to the Issues » Custom Fields page
        • Create a new Advanced » Username of last updater or commenter and add this to all the screens
      4. Setup Jira Service Desk Mail Handler with say jira@mydomain.com as the listening email address
      5. Create a new user in Jira Administration » User Management: support@mydomain.com with email address support@mydomain.com
        • Rename support@mydomain.com and email address to support_leave@mydomain.com. Make this account inactive.
        • After the above - app_user: support@mydomain.com mapped to support_leave@mydomain.com
      6. Create another new user test@mydomain.com with email address support@mydomain.com
        • Rename test@mydomain.com to support@mydomain.com
        • After the above - app_user: test@mydomain.com mapped to support@mydomain.com
      7. Navigate to Jira Administration » System » Logging and profiling
        • Enable Incoming Mail debugging (you may need to add a dummy Incoming POP mail Server to access this debug)
        • Set com.atlassian to DEBUG
      8. Send email from support@mydomain.com to jira@mydomain.com CC admin@mydomain.com. CC must be included to trigger the exception.

      Running a tail -f on atlassian-jira-incoming-mail.log will result in this stack trace:

      com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.issue.customfields.impl.FieldValidationException: User 'test@mydomain.com' was not found in the system.
      	at com.atlassian.jira.issue.fields.ImmutableCustomField.updateIssue(ImmutableCustomField.java:1042) [classes/:?]
      	at com.atlassian.jira.bc.issue.DefaultIssueService.updateIssueFromFieldsWithoutScreenCheck(DefaultIssueService.java:850) [classes/:?]
      	at com.atlassian.jira.bc.issue.DefaultIssueService.updateIssueFromFields(DefaultIssueService.java:803) [classes/:?]
      	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndUpdateIssueFromFields(DefaultIssueService.java:684) [classes/:?]
      	at com.atlassian.jira.bc.issue.DefaultIssueService.validateUpdate(DefaultIssueService.java:286) [classes/:?]
      ...
      	at com.atlassian.servicedesk.internal.customfields.participants.ParticipantsCustomFieldManagerImpl.updateUserParticipants(ParticipantsCustomFieldManagerImpl.java:110) [?:?]
      	at com.atlassian.servicedesk.internal.feature.reqparticipants.field.RequestParticipantsInternalManagerImpl.updateParticipantsField(RequestParticipantsInternalManagerImpl.java:110) [?:?]
      	at com.atlassian.servicedesk.internal.feature.reqparticipants.field.RequestParticipantsInternalManagerImpl.lambda$addParticipants$5(RequestParticipantsInternalManagerImpl.java:71) [?:?]
      ...
      Caused by: com.atlassian.jira.issue.customfields.impl.FieldValidationException: User 'test@mydomain.com' was not found in the system.
      	at com.atlassian.jira.issue.customfields.converters.UserConverterImpl.getUser(UserConverterImpl.java:50) [classes/:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0_102]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:1.8.0_102]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:1.8.0_102]
      	at java.lang.reflect.Method.invoke(Method.java:498) [?:1.8.0_102]
      	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) [atlassian-plugins-core-4.1.0.jar:?]
      	at com.sun.proxy.$Proxy28.getUser(Unknown Source) [?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0_102]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:1.8.0_102]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:1.8.0_102]
      	at java.lang.reflect.Method.invoke(Method.java:498) [?:1.8.0_102]
      	at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:136) [?:?]
      	at com.sun.proxy.$Proxy28.getUser(Unknown Source) [?:?]
      	at com.atlassian.jira.toolkit.customfield.AuthorOfLastUpdateOrCommentCFType.getSingularObjectFromString(AuthorOfLastUpdateOrCommentCFType.java:55) [?:?]
      	at com.atlassian.jira.issue.customfields.impl.CalculatedCFType.getValueFromCustomFieldParams(CalculatedCFType.java:65) [jira-api-7.2.7.jar:?]
      	at com.atlassian.jira.issue.fields.ImmutableCustomField.updateIssue(ImmutableCustomField.java:1038) [classes/:?]
      	... 121 more
      

      Expected Result

      As both the sender and participant are valid users, the participants should have been added to the newly created ticket.

      Actual Result

      The above stack trace is thrown, the ticket is then created with no participants added.

      Cause

      The root cause appears to be caused by Jira Toolkit Pligin and specifically the Username of last updater or commenter (AuthorOfLastUpdateOrCommentCFType) Custom Field type not handling the scenario when a user has been renamed.

      Resolution

      Update the Jira Toolkit add-on to at least Version 0.35.14 which fixes this bug.

          Form Name

            [JSDSERVER-5465] Jira Toolkit AuthorOfLastUpdateOrCommentCFType does not handle renamed usernames

            No work has yet been logged on this issue.

              mmcmahon Matthew McMahon (Inactive)
              hlam@atlassian.com Eric Lam
              Affected customers:
              0 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: