Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4182

NullPointerException in DefaultUrlHelper

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.15.1
    • Fix Version/s: 2.3.16
    • Component/s: Core Actions
    • Labels:
      None

      Description

      In the method DefaultUrlHelper.buildParametersString(...) a NullPointerException occurs whenever an array or iterable parameter containing null elements is passed.

      The problem seems to be lines 214 and 244, which look the same:

      link.append(buildParameterSubstring(name, paramValue.toString()));
      

      For null parameters an empty string is written to the url:

      value != null ? value.toString() : StringUtils.EMPTY
      

      A fix would be to check paramValue for null as well, thus allowing arrays or iterables to contain null elements.

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Struts2-JDK6 #814 (See https://builds.apache.org/job/Struts2-JDK6/814/)
        WW-4182 Adds additional check to avoid NPE (lukaszlenart: rev 1533346)

        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Struts2-JDK6 #814 (See https://builds.apache.org/job/Struts2-JDK6/814/ ) WW-4182 Adds additional check to avoid NPE (lukaszlenart: rev 1533346) /struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Solved, thanks for reporting!

        Show
        lukaszlenart Lukasz Lenart added a comment - Solved, thanks for reporting!
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1533346 from Lukasz Lenart in branch 'struts2/trunk'
        [ https://svn.apache.org/r1533346 ]

        WW-4182 Adds additional check to avoid NPE

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1533346 from Lukasz Lenart in branch 'struts2/trunk' [ https://svn.apache.org/r1533346 ] WW-4182 Adds additional check to avoid NPE

          People

          • Assignee:
            lukaszlenart Lukasz Lenart
            Reporter:
            thomasgo Thomas Goettlich
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development