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

Array-of-null parameters are converted to arrays containing "null"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.5, 2.5.8
    • Fix Version/s: 2.5.12
    • Component/s: Core
    • Labels:
      None

      Description

      The org.apache.struts2.dispatcher.Parameter.Request class (added in Struts 2.5.3) incorrectly handles arrays containing null; it converts them to arrays containing the string "null" (using String.valueOf).

      This is breaking one of our applications; some pages are OK, but on other pages, every non-provided field is populated with "null".

        Issue Links

          Activity

          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Can you post an example action with jsp?

          Show
          lukaszlenart Lukasz Lenart added a comment - Can you post an example action with jsp?
          Hide
          thrawnca Mitth'raw'nuruodo added a comment - - edited

          I could, but I'm not sure how many files I'd need to post before it would make sense, and since we're unable to update to the latest (thus most secure) version of Struts, I'm not sure it's wise for us to be publicly sharing source code.

          I'll aim to post redacted versions.

          Can Parameter.Request.toStringArray simply be adjusted to handle arrays of nulls properly?

          Show
          thrawnca Mitth'raw'nuruodo added a comment - - edited I could, but I'm not sure how many files I'd need to post before it would make sense, and since we're unable to update to the latest (thus most secure) version of Struts, I'm not sure it's wise for us to be publicly sharing source code. I'll aim to post redacted versions. Can Parameter.Request.toStringArray simply be adjusted to handle arrays of nulls properly?
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user ThrawnCA opened a pull request:

          https://github.com/apache/struts/pull/115

          WW-4737 Properly handle arrays containing nulls

          Don't convert null to "null"

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/ThrawnCA/struts WW-4737

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/struts/pull/115.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #115


          commit 58667e64970c528461cf7c5835f9a253c969f737
          Author: antuarc <carl.antuar@dsiti.qld.gov.au>
          Date: 2017-02-01T02:26:31Z

          WW-4737 preserve nulls instead of converting them to the string 'null'

          • Also simplify if-else logic to be more readable and avoid double-negatives

          commit 26bc9cd64bd9e69f7bf2e1076150806581c355f4
          Author: antuarc <carl.antuar@dsiti.qld.gov.au>
          Date: 2017-02-01T02:27:02Z

          WW-4737 add unit testing for parameters being converted to string arrays


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user ThrawnCA opened a pull request: https://github.com/apache/struts/pull/115 WW-4737 Properly handle arrays containing nulls Don't convert null to "null" You can merge this pull request into a Git repository by running: $ git pull https://github.com/ThrawnCA/struts WW-4737 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/struts/pull/115.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #115 commit 58667e64970c528461cf7c5835f9a253c969f737 Author: antuarc <carl.antuar@dsiti.qld.gov.au> Date: 2017-02-01T02:26:31Z WW-4737 preserve nulls instead of converting them to the string 'null' Also simplify if-else logic to be more readable and avoid double-negatives commit 26bc9cd64bd9e69f7bf2e1076150806581c355f4 Author: antuarc <carl.antuar@dsiti.qld.gov.au> Date: 2017-02-01T02:27:02Z WW-4737 add unit testing for parameters being converted to string arrays
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 58667e64970c528461cf7c5835f9a253c969f737 in struts's branch refs/heads/master from antuarc
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=58667e6 ]

          WW-4737 preserve nulls instead of converting them to the string 'null'

          • Also simplify if-else logic to be more readable and avoid double-negatives
          Show
          jira-bot ASF subversion and git services added a comment - Commit 58667e64970c528461cf7c5835f9a253c969f737 in struts's branch refs/heads/master from antuarc [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=58667e6 ] WW-4737 preserve nulls instead of converting them to the string 'null' Also simplify if-else logic to be more readable and avoid double-negatives
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 26bc9cd64bd9e69f7bf2e1076150806581c355f4 in struts's branch refs/heads/master from antuarc
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=26bc9cd ]

          WW-4737 add unit testing for parameters being converted to string arrays

          Show
          jira-bot ASF subversion and git services added a comment - Commit 26bc9cd64bd9e69f7bf2e1076150806581c355f4 in struts's branch refs/heads/master from antuarc [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=26bc9cd ] WW-4737 add unit testing for parameters being converted to string arrays
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4b96958be90b45e959ef600b89af33833d51eb27 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=4b96958 ]

          WW-4737 Fixes issue with array of nulls

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4b96958be90b45e959ef600b89af33833d51eb27 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=4b96958 ] WW-4737 Fixes issue with array of nulls
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/struts/pull/115

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/struts/pull/115
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          PR merged, thanks a lot!

          Show
          lukaszlenart Lukasz Lenart added a comment - PR merged, thanks a lot!
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Struts-JDK7-master #591 (See https://builds.apache.org/job/Struts-JDK7-master/591/)
          WW-4737 preserve nulls instead of converting them to the string 'null' (carl.antuar: rev 58667e64970c528461cf7c5835f9a253c969f737)

          • (edit) core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
            WW-4737 add unit testing for parameters being converted to string (carl.antuar: rev 26bc9cd64bd9e69f7bf2e1076150806581c355f4)
          • (add) core/src/test/java/org/apache/struts2/dispatcher/ParameterTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #591 (See https://builds.apache.org/job/Struts-JDK7-master/591/ ) WW-4737 preserve nulls instead of converting them to the string 'null' (carl.antuar: rev 58667e64970c528461cf7c5835f9a253c969f737) (edit) core/src/main/java/org/apache/struts2/dispatcher/Parameter.java WW-4737 add unit testing for parameters being converted to string (carl.antuar: rev 26bc9cd64bd9e69f7bf2e1076150806581c355f4) (add) core/src/test/java/org/apache/struts2/dispatcher/ParameterTest.java

            People

            • Assignee:
              Unassigned
              Reporter:
              thrawnca Mitth'raw'nuruodo
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development