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

Scope interceptor always resets because of org.apache.struts2.dispatcher.HttpParameters

    Details

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

      Description

      Line 302 of org.apache.struts2.interceptor.ScopeInterceptor performs a not-null check to see if a session reset parameter exists by calling com.opensymphony.xwork2.ActionContext.getParameters().get(...).

      The return type of getParameters() is org.apache.struts2.dispatcher.HttpParameters, and HttpParamters.get() never returns null on a missing parameter, causing the not-null check to always evaluate to true.

      This breaks the interceptor by short circuiting the scoped variable injection.

        Activity

        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Thanks, resolved! I have also checked other places and found one more such wrong null-checking.

        Show
        lukaszlenart Lukasz Lenart added a comment - Thanks, resolved! I have also checked other places and found one more such wrong null-checking.
        Hide
        jira-bot ASF subversion and git services added a comment -

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

        WW-4715 Uses isDefined function instead of null-checking

        Show
        jira-bot ASF subversion and git services added a comment - Commit a245226b7f1fa2a2cd94508b132f0220989c1e5b in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=a245226 ] WW-4715 Uses isDefined function instead of null-checking
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-JDK7-master #554 (See https://builds.apache.org/job/Struts-JDK7-master/554/)
        WW-4715 Uses isDefined function instead of null-checking (lukaszlenart: rev a245226b7f1fa2a2cd94508b132f0220989c1e5b)

        • (edit) core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
        • (edit) core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #554 (See https://builds.apache.org/job/Struts-JDK7-master/554/ ) WW-4715 Uses isDefined function instead of null-checking (lukaszlenart: rev a245226b7f1fa2a2cd94508b132f0220989c1e5b) (edit) core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java (edit) core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
        Hide
        xxbeanxx Greg Baker added a comment -

        Thanks for the quick resolution.

        Show
        xxbeanxx Greg Baker added a comment - Thanks for the quick resolution.

          People

          • Assignee:
            Unassigned
            Reporter:
            xxbeanxx Greg Baker
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development