Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-34348

LegacyAdminLinkFactory uses ServletActionContext to get Request. It should use ExecutingHttpRequest.get()

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Cloud. Using JIRA Server? See the corresponding bug report.

      In LegacyAdminLinkFactory we have this code:

       @Override
          public List<SimpleLink> getLinks(User user, Map<String, Object> params)
          {
              final JiraHelper helper = new JiraHelper(ServletActionContext.getRequest());
              final List<SimpleLink> ret = new ArrayList<SimpleLink>();
      
              final List<SimpleLinkSection> sections = simpleLinkManager.getSectionsForLocation(SYSTEM_ADMIN_LOCATION, user, helper);
              for (SimpleLinkSection section : sections)
              {
                  ret.addAll(simpleLinkManager.getLinksForSection(SYSTEM_ADMIN_LOCATION + "/" + section.getId(), user, helper));
              }
              return ret;
          }
      

      This causes problems when using admin quick search g + g (which goes through REST) with legacy links:

      [INFO] [talledLocalContainer] 2013-08-16 13:17:46,204 http-bio-2990-exec-40 DEBUG admin 797x2281x1 h451kq 0:0:0:0:0:0:0:1%0 /rest/adminquicksearch/latest/links/default [jira.plugin.webfragment.DefaultSimpleLinkManager] RuntimeException converting item 'com.atlassian.jira.ext.anyfooter:anyfooter-config-link' to Simple link. This link will be skipped.
      [INFO] [talledLocalContainer] java.lang.NullPointerException
      [INFO] [talledLocalContainer] 	at com.atlassian.plugin.web.model.DefaultWebLink.getDisplayableUrl(DefaultWebLink.java:47)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.plugin.webfragment.model.JiraWebLink.getDisplayableUrl(JiraWebLink.java:39)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.plugin.webfragment.DefaultSimpleLinkManager.convertWebItemToSimpleLink(DefaultSimpleLinkManager.java:286)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.plugin.webfragment.DefaultSimpleLinkManager.getLinks(DefaultSimpleLinkManager.java:191)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.plugin.webfragment.DefaultSimpleLinkManager.getLinksForSection(DefaultSimpleLinkManager.java:132)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.admin.LegacyAdminLinkFactory.getLinks(LegacyAdminLinkFactory.java:46)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.plugin.webfragment.DefaultSimpleLinkManager.getLinks(DefaultSimpleLinkManager.java:204)
      [INFO] [talledLocalContainer] 	at com.atlassian.jira.plugin.webfragment.DefaultSimpleLinkManager.getLinksForSection(DefaultSimpleLinkManager.java:132)
      [INFO] [talledLocalContainer] 	at sun.reflect.GeneratedMethodAccessor281.invoke(Unknown Source)
      [INFO] [talledLocalContainer] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegati
      

      It should use ExcecutingHttpRequest.get() to get the request which also works for REST (ServletActionContext only works for webwork requests).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              andreask@atlassian.com Andreas Knecht (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: