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.

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

            Owen made changes -
            Workflow Original: JSD Bug Workflow v5 - TEMP [ 2471218 ] New: JAC Bug Workflow v3 [ 3125895 ]
            Status Original: Done [ 10044 ] New: Closed [ 6 ]
            Grégory Joseph (Inactive) made changes -
            Link New: This issue is related to JSDCLOUD-5744 [ JSDCLOUD-5744 ]
            Matthew McMahon (Inactive) made changes -
            Remote Link New: This issue links to "JTOOL-238 (Ecosystem JIRA)" [ 329781 ]
            Eric Lam made changes -
            Description Original: h2. *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}}.

            h2. *How to reproduce*

            # Install JIRA Service Desk
            #* Create a new user on setup with email address {{admin@mydomain.com}}
            # Through *Jira Administration* » *Add-ons* » *Find new add-ons*
            #* Install *Jira Toolkit*
            # Navigate to the *Issues* » *Custom Fields* page
            #* Create a new *Advanced* » *Username of last updater or commenter* and add this to all the screens
            # Setup Jira Service Desk Mail Handler with say _{{jira@mydomain.com}}_ as the listening email address
            # 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}}
            # 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}}
            # 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*
            # 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:

            {code}
            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
            {code}

            h2. *Expected Result*

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

            h2. *Actual Result*

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

            h2. *Cause*

            The root cause appears to be caused by [Jira Toolkit Pligin|https://marketplace.atlassian.com/plugins/com.atlassian.jira.toolkit/server/overview] and specifically the *Username of last updater or commenter* (AuthorOfLastUpdateOrCommentCFType) Custom Field type not handling the scenario when a user has been renamed.

            h2. *Work around*

            Delete the *Username of last updater or commenter* (AuthorOfLastUpdateOrCommentCFType) from *Jira Administration* » *Issues* » *Custom Fields*. Simply un-associating the Custom Field from the Custom Fields is not sufficient to avoid the Stack Trace error.

            Review and implement the suggestion on this [Community Post|https://community.atlassian.com/t5/Jira-questions/Is-there-a-way-to-see-the-last-update-author/qaq-p/78531] if it fulfills the requirements.
            New: h2. *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}}.

            h2. *How to reproduce*

            # Install JIRA Service Desk
            #* Create a new user on setup with email address {{admin@mydomain.com}}
            # Through *Jira Administration* » *Add-ons* » *Find new add-ons*
            #* Install *Jira Toolkit*
            # Navigate to the *Issues* » *Custom Fields* page
            #* Create a new *Advanced* » *Username of last updater or commenter* and add this to all the screens
            # Setup Jira Service Desk Mail Handler with say _{{jira@mydomain.com}}_ as the listening email address
            # 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}}
            # 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}}
            # 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*
            # 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:

            {code}
            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
            {code}

            h2. *Expected Result*

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

            h2. *Actual Result*

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

            h2. *Cause*

            The root cause appears to be caused by [Jira Toolkit Pligin|https://marketplace.atlassian.com/plugins/com.atlassian.jira.toolkit/server/overview] and specifically the *Username of last updater or commenter* (AuthorOfLastUpdateOrCommentCFType) Custom Field type not handling the scenario when a user has been renamed.

            h2. *Resolution*

            Update the [Jira Toolkit add-on|https://marketplace.atlassian.com/plugins/com.atlassian.jira.toolkit/server/overview] to at least Version 0.35.14 which fixes this bug.

            Note that https://ecosystem.atlassian.net/projects/JTOOL/issues is the correct location to raise any issues with the JIRA Toolkit plugin.

            Matthew McMahon (Inactive) added a comment - Note that https://ecosystem.atlassian.net/projects/JTOOL/issues is the correct location to raise any issues with the JIRA Toolkit plugin.
            Matthew McMahon (Inactive) made changes -
            Assignee New: Matthew McMahon [ mmcmahon ]
            Matthew McMahon (Inactive) made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Untriaged [ 11672 ] New: Done [ 10044 ]

            This has been fixed.

            The problem is unrelated to JIRA Service Desk, but has been fixed in the latest version of JIRA Toolkit Plugin v0.35.14

            https://marketplace.atlassian.com/plugins/com.atlassian.jira.toolkit/versions#b224

            Matthew McMahon (Inactive) added a comment - This has been fixed. The problem is unrelated to JIRA Service Desk, but has been fixed in the latest version of JIRA Toolkit Plugin v0.35.14 https://marketplace.atlassian.com/plugins/com.atlassian.jira.toolkit/versions#b224
            Matthew McMahon (Inactive) made changes -
            Affects Version/s New: 3.8.1 [ 75430 ]
            Eric Lam made changes -
            Affects Version/s Original: 3.8.0 [ 73404 ]

              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: