Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-24593

CommentImpl should be using the OSUserConverter.convertToOSUser() and userManager.getUserEvenWhenUnknown() when returning the comment author and updated author

    XMLWordPrintable

Details

    Description

      Hi Guys,

      I have just hit a case where I have a JIRA instance hooked up to LDAP and a bunch of users have been deleted underneath JIRA.

      I also been using the REST API to retrieve issues from JIRA.

      What now occurs is a nice little 500 when trying to retrieve issues via REST where a user has commented on an issue where that user has been deleted. All the issue fields are fine, since they handle the deleted user just fine, but the underlying CommentImpl does not.

      I have worked around this in a patched version of the REST plugin for now, BUT, the fix should occur in the CommentImpl.

      Really all usages of UserUtil.* in this class need to be replaced with the much safer call, like what is used in the IssueImpl:

              if (username != null)
              {
                  return OSUserConverter.convertToOSUser(userManager.getUserEvenWhenUnknown(username));
              }
              else
              {
                  return null;
              }
      

      Really returning null sucks pretty hard as well, I would probably just call:

      return OSUserConverter.convertToOSUser(userManager.getUserEvenWhenUnknown(username));
      

      Which will handle the null username just fine, and return a new ImmutableUser:

      new ImmutableUser.Builder().name(userName).displayName(userName).active(false).toUser();
      

      Anyway, would love to see this little fix in the next point release ... Peter ??

      See you all soon,

      Jus

      Attachments

        Activity

          People

            Unassigned Unassigned
            justin@atlassian.com Justin Koke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: