You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Don Brown (JIRA)" <ji...@apache.org> on 2008/06/13 02:12:05 UTC

[jira] Updated: (WW-2297) Using ServletActionRedirectResult (within @Result) and extra parameters.

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

Don Brown updated WW-2297:
--------------------------

    Fix Version/s:     (was: 2.1.4)
                   2.1.3

> 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
>             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.