Struts 2
  1. Struts 2
  2. WW-3107

NPE whlie use ServletActionRedirectResult as Result type

    Details

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

      Description

      This bug was appeared after WW-3046
      Example
      public ServletActionRedirectResult generate()
      throws Exception
      {
      ServletActionRedirectResult redirect = new ServletActionRedirectResult("/namespace", "someaction", "method");
      redirect.addParameter("param", "value");
      return redirect;
      }
      After execute this method we have caught NPE in codeplace:
      -----ServletActionRedirectResult.class
      (169 line)
      ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(invocation.getResultCode());
      Map resultConfigParams = resultConfig.getParams();
      -----ServletActionRedirectResult
      invocation.getResultCode() == null and as result resultConfig == null
      Upd: stacktrace
      java.lang.NullPointerException
      at org.apache.struts2.dispatcher.ServletRedirectResult.doExecute(ServletRedirectResult.java:170)
      at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
      at org.apache.struts2.dispatcher.ServletActionRedirectResult.execute(ServletActionRedirectResult.java:176)
      at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
      at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
      at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:251)
      at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
      -----cut-----

        Activity

        Hide
        Wes Wannemacher added a comment -

        This would appear to be an easy fix, I am going to try to reproduce and see if a simple null-check will fix it. If it takes more than that, I'm going to bump this to 2.1.8.

        Show
        Wes Wannemacher added a comment - This would appear to be an easy fix, I am going to try to reproduce and see if a simple null-check will fix it. If it takes more than that, I'm going to bump this to 2.1.8.
        Hide
        Wes Wannemacher added a comment -

        good catch Andrey, thanks!

        Show
        Wes Wannemacher added a comment - good catch Andrey, thanks!

          People

          • Assignee:
            Wes Wannemacher
            Reporter:
            Andrey Vasenin
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development