[ 
https://issues.apache.org/struts/browse/WW-2297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Don Brown resolved WW-2297.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

Yep, I just fixed this in response to WW-2676

> Using ServletActionRedirectResult (within @Result) and extra parameters.
> ------------------------------------------------------------------------
>
>                 Key: WW-2297
>                 URL: https://issues.apache.org/struts/browse/WW-2297
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: David Artiga
>            Assignee: Don Brown
>             Fix For: 2.1.3
>
>
> Given the following class and annotations:
> @Results(
>    @Result(name = Action.SUCCESS, value = "myAction", 
> type=ServletActionRedirectResult.class, params = { "param1", "value1" })
> )
> public class MyAction implements Action {
>    ...
> }
> In method 'buildResult' from 'com.opensymphony.xwork2ObjectFactory' class:
>  if (resultClassName != null) {
>             result = (Result) buildBean(resultClassName, extraContext);
>             try {
>               OgnlUtil.setProperties(resultConfig.getParams(), result, 
> extraContext, true);
>             } catch (XWorkException ex) {
>                 ...
>             }
> ...
> }
> When dealing with the readult an ognl.NoSuchPropertyException is thrown for 
> property 'param1'. 
> This is not a problem if the action is mapped using a XML file, because 
> "actionName" property has been set earlier (resultConfig.requestParameters = 
> { "actionName=myAction","param1=value1"}).
> But when using annotations, the requestParameters order changes( 
> {"param1=value1", "actionName=myAction"}), so when throwing the exception 
> "actioName" has not been set yet, and then the Result created has no 
> actionName (=null).
> That causes a NullPointerException when trying to process the result.
> Possible patch (inform Ognl to not throw exceptions when setting properties):
> OgnlUtil.setProperties(resultConfig.getParams(), result, extraContext, /* --> 
> */ false /* <-- */ );

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to