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

Array-of-null parameters are converted to string "null"

    Details

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

      Description

      The com.opensymphony.xwork2.conversion.impl.StringConverter class, since Struts 2.5.11, 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 the String "null".

      This is a similar issue to WW-4737, but occurring in different code.

      Please ensure that conversion to String always uses the two-argument version of Objects.toString, which preserves nulls, rather than String.valueOf, which converts them to the four-letter string "null".

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Struts-master-JDK7 #12 (See https://builds.apache.org/job/Struts-master-JDK7/12/)
          WW-4831 convert nulls within arrays to empty strings rather than the 4 (shell_layer-github: rev 8cc56b2974e5c744954b110e645f61f18e0b12ab)

          • (edit) core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java
            WW-4831 add unit tests for conversion of String arrays (shell_layer-github: rev 60d61fac0abb5993977e84f8dcc5bea6588f41d6)
          • (edit) core/src/test/java/com/opensymphony/xwork2/conversion/impl/StringConverterTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-master-JDK7 #12 (See https://builds.apache.org/job/Struts-master-JDK7/12/ ) WW-4831 convert nulls within arrays to empty strings rather than the 4 (shell_layer-github: rev 8cc56b2974e5c744954b110e645f61f18e0b12ab) (edit) core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java WW-4831 add unit tests for conversion of String arrays (shell_layer-github: rev 60d61fac0abb5993977e84f8dcc5bea6588f41d6) (edit) core/src/test/java/com/opensymphony/xwork2/conversion/impl/StringConverterTest.java
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          PR got merged, thanks!

          Show
          lukaszlenart Lukasz Lenart added a comment - PR got merged, thanks!
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/struts/pull/154
          Hide
          jira-bot ASF subversion and git services added a comment -

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

          WW-4831 Converts nulls to nulls

          Show
          jira-bot ASF subversion and git services added a comment - Commit 7f90a4fec9e6718621c4f195fe7a334d43d8a2bb in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=7f90a4f ] WW-4831 Converts nulls to nulls
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 60d61fac0abb5993977e84f8dcc5bea6588f41d6 in struts's branch refs/heads/master from thrawnca
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=60d61fa ]

          WW-4831 add unit tests for conversion of String arrays

          Show
          jira-bot ASF subversion and git services added a comment - Commit 60d61fac0abb5993977e84f8dcc5bea6588f41d6 in struts's branch refs/heads/master from thrawnca [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=60d61fa ] WW-4831 add unit tests for conversion of String arrays
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8cc56b2974e5c744954b110e645f61f18e0b12ab in struts's branch refs/heads/master from thrawnca
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=8cc56b2 ]

          WW-4831 convert nulls within arrays to empty strings rather than the 4 letters 'null'

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8cc56b2974e5c744954b110e645f61f18e0b12ab in struts's branch refs/heads/master from thrawnca [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=8cc56b2 ] WW-4831 convert nulls within arrays to empty strings rather than the 4 letters 'null'
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user ThrawnCA opened a pull request:

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

          WW-4831 properly convert nulls in arrays

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

          $ git pull https://github.com/ThrawnCA/struts WW-4831-preserve-nulls-in-arrays

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

          https://github.com/apache/struts/pull/154.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 #154


          commit 8cc56b2974e5c744954b110e645f61f18e0b12ab
          Author: thrawnca <shell_layer-github@yahoo.com.au>
          Date: 2017-08-01T01:51:20Z

          WW-4831 convert nulls within arrays to empty strings rather than the 4 letters 'null'

          commit 60d61fac0abb5993977e84f8dcc5bea6588f41d6
          Author: thrawnca <shell_layer-github@yahoo.com.au>
          Date: 2017-08-01T01:51:37Z

          WW-4831 add unit tests for conversion of String arrays


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user ThrawnCA opened a pull request: https://github.com/apache/struts/pull/154 WW-4831 properly convert nulls in arrays You can merge this pull request into a Git repository by running: $ git pull https://github.com/ThrawnCA/struts WW-4831 -preserve-nulls-in-arrays Alternatively you can review and apply these changes as the patch at: https://github.com/apache/struts/pull/154.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 #154 commit 8cc56b2974e5c744954b110e645f61f18e0b12ab Author: thrawnca <shell_layer-github@yahoo.com.au> Date: 2017-08-01T01:51:20Z WW-4831 convert nulls within arrays to empty strings rather than the 4 letters 'null' commit 60d61fac0abb5993977e84f8dcc5bea6588f41d6 Author: thrawnca <shell_layer-github@yahoo.com.au> Date: 2017-08-01T01:51:37Z WW-4831 add unit tests for conversion of String arrays

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              thrawnca Mitth'raw'nuruodo
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development