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

Resin 2.1.17 throws NullPointerException on View Issue

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 3.7
    • 3.7
    • None
    • Resin 2.1.16 / 2.1.17, and JIRA head (after implementation of the decorator for view issue's left hand side)

    Description

      Ok - here's the problem:

      java.lang.NullPointerException
      	at com.caucho.server.http.DispatchRequest.getContextPath(DispatchRequest.java:173)
      	at com.atlassian.jira.plugin.JiraResourcedModuleDescriptor.getDefaultVelocityParams(JiraResourcedModuleDescriptor.java:217)
      	at com.atlassian.jira.web.component.issuesummary.IssueSummaryWebComponent.getDefaultParams(IssueSummaryWebComponent.java:71)
      	at com.atlassian.jira.web.component.issuesummary.IssueSummaryWebComponent.getHtml(IssueSummaryWebComponent.java:66)
      	at _decorators._issuesummary__jsp._jspService(_issuesummary__jsp.java:1583)
      

      In Resin, it uses a new request for each 'include' that it does. JSP include, using a requestwrapper etc. In JIRA's ServletRequestDispatcher (webwork implementation), we capture the Request in a Thread Local, and use it later on in the request. We also do the same with the action context.

      After each request has completed, it gets returned to the pool, and all of its internal state cleared.

      The problem that has been introduced with the new decorator is that in the decorator gets the request out of the Thread Local (ActionContext.getRequest()): JiraResourcedModuleDescriptor.getDefaultVelocityParams(). However, as this request has been released back into the pool, the request.getContextPath() has been cleared, which throws the NullPointerException.

      The solution is for our templates to not depend on the HttpServletRequest object, but instead see what we use from it, and provide that to the velocity context instead. A quick search shows that the request object isn't used in that many places (at least inside JIRA):

      for i in `find . -name *.vm` ; do grep "\$req" $i | grep -v "\$req.getContextPath()" | grep -v "\$req.contextPath" ; done;
      

      Mostly we just use the contextPath, and we could find a better variable name for that.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scott@atlassian.com Scott Farquhar
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: