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

ChainingInterceptor does not handle lists correctly for excludes and includes

    Details

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

      Description

      The ChainingInterceptor has two parameters includes and excludes that according to the documentation and the code are Collection<String>, but the setters don't handle the specified values (that are loaded from the struts.xml) as lists. So if i specify for example
      <interceptor-ref name="chain">
      <param name="includes">x,y,z</param>
      </interceptor-ref>
      the includes variable of the interceptor becomes a Collection of one string with the value "x,y,z" instead of a Collection of three strings "x", "y" and "z".
      The behaviour should instead be similar to the ParametersInterceptor's excludeParams or MethodFilterInterceptor's excludeMethods and includeMethods.

      It would also be good if the documentation included information and an example with a list of parameters. The current documentation (https://struts.apache.org/docs/chaining-interceptor.html) only says that the parameters are lists, but the example only has one parameter

        Issue Links

          Activity

          Hide
          lukaszlenart Lukasz Lenart added a comment -

          You are right, but it should be possible to use OGNL array syntax

          <interceptor-ref name="chain">
            <param name="excludes">[x,y,z]</param>
          </interceptor-ref>
          
          Show
          lukaszlenart Lukasz Lenart added a comment - You are right, but it should be possible to use OGNL array syntax <interceptor-ref name= "chain" > <param name= "excludes" >[x,y,z]</param> </interceptor-ref>
          Hide
          nikos nikos dimitrakas added a comment -

          I have already tried that and it doesn't work. I get an Collection with one string "[x,y,z]".

          Show
          nikos nikos dimitrakas added a comment - I have already tried that and it doesn't work. I get an Collection with one string " [x,y,z] ".
          Hide
          lukaszlenart Lukasz Lenart added a comment -
          <interceptor-ref name="chain">
            <param name="excludes">{'x','y','x'}</param>
          </interceptor-ref>
          

          http://struts.apache.org/docs/ognl.html#OGNL-Collections(Maps,Lists,Sets)

          Show
          lukaszlenart Lukasz Lenart added a comment - <interceptor-ref name= "chain" > <param name= "excludes" >{'x','y','x'}</param> </interceptor-ref> http://struts.apache.org/docs/ognl.html#OGNL-Collections(Maps,Lists,Sets )
          Hide
          nikos nikos dimitrakas added a comment -

          I have tried that too. With single quotes, with double quotes, with no quotes. No difference. The interceptor sees this as a single string every time. I even tried to put the expresion within ${} and %{} but it didn't help.

          Show
          nikos nikos dimitrakas added a comment - I have tried that too. With single quotes, with double quotes, with no quotes. No difference. The interceptor sees this as a single string every time. I even tried to put the expresion within ${} and %{} but it didn't help.
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Show
          lukaszlenart Lukasz Lenart added a comment -
          Hide
          yasser.zamani Yasser Zamani added a comment - - edited

          I will be working on it. The problem is set(Includes/Excludes) are being called with String as parameter rather than Collection<String> and no where they are being converted nor compiled by OGNL.

          I will be working on it for a suitable clean solution according to the rest of codes.

          Show
          yasser.zamani Yasser Zamani added a comment - - edited I will be working on it. The problem is set(Includes/Excludes) are being called with String as parameter rather than Collection<String> and no where they are being converted nor compiled by OGNL. I will be working on it for a suitable clean solution according to the rest of codes.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user yasserzamani opened a pull request:

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

          WW-4528 handling ChainingInterceptor excludes and includes lists

          With these changes, they will be handled as comma separated String like what ParameterFilterInterceptor do.

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

          $ git pull https://github.com/yasserzamani/struts WW-4528

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

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



          Show
          githubbot ASF GitHub Bot added a comment - GitHub user yasserzamani opened a pull request: https://github.com/apache/struts/pull/116 WW-4528 handling ChainingInterceptor excludes and includes lists With these changes, they will be handled as comma separated String like what ParameterFilterInterceptor do. You can merge this pull request into a Git repository by running: $ git pull https://github.com/yasserzamani/struts WW-4528 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/struts/pull/116.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 #116
          Hide
          yasser.zamani Yasser Zamani added a comment -

          I also added an Unit test at this commit which checks for any similar issue occurrence in future.

          This Unit test fails for current code but passes for PR#116.

          Show
          yasser.zamani Yasser Zamani added a comment - I also added an Unit test at this commit which checks for any similar issue occurrence in future. This Unit test fails for current code but passes for PR#116 .
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 0437efc6f91c2b78d84f673a63d45ef2765782db in struts's branch refs/heads/master from Yasser Zamani
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=0437efc ]

          WW-4528 handling ChainingInterceptor excludes and includes lists as
          comma separated String like ParameterFilterInterceptor do

          Show
          jira-bot ASF subversion and git services added a comment - Commit 0437efc6f91c2b78d84f673a63d45ef2765782db in struts's branch refs/heads/master from Yasser Zamani [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=0437efc ] WW-4528 handling ChainingInterceptor excludes and includes lists as comma separated String like ParameterFilterInterceptor do
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 7140e0192b537f1ff388fbf00758b591a9cdeb6f in struts's branch refs/heads/master from Yasser Zamani
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=7140e01 ]

          WW-4528 correcting testTwoExcludesPropertiesChained unit test

          Show
          jira-bot ASF subversion and git services added a comment - Commit 7140e0192b537f1ff388fbf00758b591a9cdeb6f in struts's branch refs/heads/master from Yasser Zamani [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=7140e01 ] WW-4528 correcting testTwoExcludesPropertiesChained unit test
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 51c0bcbb8bf4103a5c97be0f6372725f792f470e in struts's branch refs/heads/master from Yasser Zamani
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=51c0bcb ]

          WW-4528 improving testTwoExcludesPropertiesChained unit test

          Show
          jira-bot ASF subversion and git services added a comment - Commit 51c0bcbb8bf4103a5c97be0f6372725f792f470e in struts's branch refs/heads/master from Yasser Zamani [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=51c0bcb ] WW-4528 improving testTwoExcludesPropertiesChained unit test
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 805cdd7754400149e166edc80b92fa2d67133d39 in struts's branch refs/heads/master from Yasser Zamani
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=805cdd7 ]

          Add an Unit test to check if same issue as WW-4528 has occurred

          Show
          jira-bot ASF subversion and git services added a comment - Commit 805cdd7754400149e166edc80b92fa2d67133d39 in struts's branch refs/heads/master from Yasser Zamani [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=805cdd7 ] Add an Unit test to check if same issue as WW-4528 has occurred
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

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

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

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

          WW-4528 Supports includes/excludes as lists

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9fcf2dfca7fb7a4d95a83665030411fc0c65c85b in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=9fcf2df ] WW-4528 Supports includes/excludes as lists
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          PR got merged, thanks!

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

          SUCCESS: Integrated in Jenkins build Struts-JDK7-master #595 (See https://builds.apache.org/job/Struts-JDK7-master/595/)
          WW-4528 handling ChainingInterceptor excludes and includes lists as (y.zamani.b: rev 0437efc6f91c2b78d84f673a63d45ef2765782db)

          • (edit) core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
          • (edit) core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java
          • (edit) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java
            WW-4528 correcting testTwoExcludesPropertiesChained unit test (y.zamani.b: rev 7140e0192b537f1ff388fbf00758b591a9cdeb6f)
          • (edit) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java
            WW-4528 improving testTwoExcludesPropertiesChained unit test (y.zamani.b: rev 51c0bcbb8bf4103a5c97be0f6372725f792f470e)
          • (edit) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java
            Add an Unit test to check if same issue as WW-4528 has occurred (yasser.zamani: rev 805cdd7754400149e166edc80b92fa2d67133d39)
          • (add) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorWithConfigTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #595 (See https://builds.apache.org/job/Struts-JDK7-master/595/ ) WW-4528 handling ChainingInterceptor excludes and includes lists as (y.zamani.b: rev 0437efc6f91c2b78d84f673a63d45ef2765782db) (edit) core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java (edit) core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java (edit) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java WW-4528 correcting testTwoExcludesPropertiesChained unit test (y.zamani.b: rev 7140e0192b537f1ff388fbf00758b591a9cdeb6f) (edit) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java WW-4528 improving testTwoExcludesPropertiesChained unit test (y.zamani.b: rev 51c0bcbb8bf4103a5c97be0f6372725f792f470e) (edit) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java Add an Unit test to check if same issue as WW-4528 has occurred (yasser.zamani: rev 805cdd7754400149e166edc80b92fa2d67133d39) (add) core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorWithConfigTest.java

            People

            • Assignee:
              Unassigned
              Reporter:
              nikos nikos dimitrakas
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development