[
https://issues.apache.org/struts/browse/WW-1714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Don Brown resolved WW-1714.
---------------------------
Resolution: Fixed
Assignee: Don Brown
The actual problem here is the way that results are created. Result parameters
are supposed to correspond to properties on the Result object, however the
action redirect result uses them as parameters for its URL. When building the
result, ognl will throw an exception, which is logged as a warn, if it can't
set the property on the result object, which in this case, is ok. I've
modified XWork to log them as debug since warn is too harsh. This has the
sideeffect of possibly hiding issues with result parameters when they really
are result properties, but I think it is the lesser of the two evils. The
whole thing needs to be re-evaluated as there shouldn't be any case when
exceptions thrown are "ok".
> Using the Redirect Action Result with parameters to the target action causes
> an OGNL warning
> --------------------------------------------------------------------------------------------
>
> Key: WW-1714
> URL: https://issues.apache.org/struts/browse/WW-1714
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.5
> Environment: WinXP; JDK 1.5; WebLogic 9.2; Struts 2.0.5; XWork 2.0.0
> Reporter: Erik Pilz
> Assigned To: Don Brown
> Fix For: 2.0.8
>
>
> Passing request parameters to the "redirect-action" result, which maps to
> org.apache.struts2.dispatcher.ServletActionRedirectResult, will log a warning
> message for every request parameter for the target action. The expected
> result is that the warning only be logged when struts.devMode is true.
> To reproduce the problem use the last example from
> http://struts.apache.org/2.x/docs/redirect-action-result.html. Here it is
> reproduced for your reference:
> <package name="passingRequestParameters" extends="struts-default"
> namespace="/passingRequestParameters">
> <-- Pass parameters (reportType, width and height) -->
> <!--
> The redirect-action url generated will be :
> /genReport/generateReport.action?userId=pie&width=100&height=100
> -->
> <action name="gatherReportInfo" class="...">
> <result name="showReportResult" type="redirect-action">
> <param name="actionName">generateReport</param>
> <param name="namespace">/genReport</param>
> <param name="reportType">pie</param>
> <param name="width">100</param>
> <param name="height">100</param>
> </result>
> </action>
> </package>
> And here's an example of the warning that is reported for a parameter named
> "userId" that is passed to the action:
> 2007-02-06 11:19:02,086 WARN [nsymphony.xwork2.util.OgnlUtil] Caught
> OgnlException while setting property 'userId' on type
> 'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
> ognl.NoSuchPropertyException:
> org.apache.struts2.dispatcher.ServletActionRedirectResult.userId
> at
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
> at
> com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
> at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1670)
> at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
> at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
> at ognl.SimpleNode.setValue(SimpleNode.java:246)
> at ognl.Ognl.setValue(Ognl.java:476)
> at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
> at
> com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:360)
> at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
> at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:49)
> at
> com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:218)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:190)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:337)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
> at
> com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213)
> at
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
> at
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> at
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
> at
> com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
> at
> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
> at
> org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
> at
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
> at
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> at
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
> at
> com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
> at
> com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:161)
> at
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> at
> com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
> at
> com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.