Redirect-Action type result warns of caught exception when passing param

View: New views
3 Messages — Rating Filter:   Alert me  

Redirect-Action type result warns of caught exception when passing param

by Michael Gagnon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My relevant mapped action look like:

 

 

<action name="GetLineItem"
class="bpf.internalOrders.action.GetInternalOrderLineItemAction" >

      <result
name="success">/jsp/admin/internalOrders/viewLineItem.jsp</result>

</action>

 

<action name="UpdateLineItem"
class="bpf.internalOrders.action.UpdateInternalOrderLineItem" >

      <result name="success" type="redirect-action">

            <param name="actionName">GetLineItem</param>

            <param name="namespace">/admin/internalOrders</param>

            <param name="parse">true</param>

            <param name="id">${id}</param>

      </result>

</action>

 

The 'GetLineItem' action works correctly when given an 'id' parameter. No
exception is shown. When forwarded to by the 'UpdateLineItem' action,
however, it displays a warning of a caught OgnlException. The parameter IS
set and the proper behavior DOES happen. I'm of the opinion that an
exception in my console means something is amiss though...

 

I see the following:

 

Apr 30, 2008 1:27:16 PM com.opensymphony.xwork2.util.OgnlUtil
internalSetProperty

WARNING: Caught OgnlException while setting property 'id' on type
'org.apache.struts2.dispatcher.ServletActionRedirectResult'.

ognl.NoSuchPropertyException:
org.apache.struts2.dispatcher.ServletActionRedirectResult.id

      at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)

      at
com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlV
alueStack.java:68)

      at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)

      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
org.apache.struts2.impl.StrutsObjectFactory.buildResult(StrutsObjectFactory.
java:95)

      at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionIn
vocation.java:195)

      at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
nvocation.java:342)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:253)

      at bpf.SessionInterceptor.intercept(SessionInterceptor.java:15)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(D
efaultWorkflowInterceptor.java:221)

      at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Validati
onInterceptor.java:150)

      at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.do
Intercept(AnnotationValidationInterceptor.java:48)

      at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(Con
versionErrorInterceptor.java:123)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:167)

      at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(St
aticParametersInterceptor.java:105)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterce
ptor.java:83)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInt
erceptor.java:207)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDr
ivenInterceptor.java:74)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingIn
terceptor.java:115)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nIntercepto
r.java:143)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareIn
terceptor.java:121)

      at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletCon
figInterceptor.java:170)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:167)

      at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasIntercep
tor.java:123)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(Ex
ceptionMappingInterceptor.java:176)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
bpf.userAccounts.interceptor.SecurityInterceptor.intercept(SecurityIntercept
or.java:28)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:224)

      at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:223)

      at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

      at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:221)

      at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)

      at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)

      at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:419)

      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)

      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

      at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java
:119)

      at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:
55)

      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)

      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

      at
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCle
anUp.java:99)

      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)

      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

      at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:233)

      at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:175)

      at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
)

      at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102
)

      at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)

      at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

      at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

      at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http
11Protocol.java:583)

      at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

      at java.lang.Thread.run(Unknown Source)

 

 

Thoughts?


RE: Redirect-Action type result warns of caught exception when passing param

by bradcupit :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I'm of the opinion that an exception in my
> console means something is amiss though...

you've stumbled upon a little wart in the code. First things first, the
exception is harmless and can be safely ignored.

A more detailed explanation can be found in a comment within
ObjectFactory.buildResult(..), posted below (slightly reformatted):

// ognl exceptions could be thrown and be ok if, for example, the result
// uses parameters in ways other than as properties for the result
object.
// For example, the redirect result from Struts 2 allows any parameters
// to be set on the result, which it appends to the redirecting url.
// These parameters wouldn't have a corresponding setter on the result
// object, so an OGNL exception could be thrown.  Still, this is a
misuse
// of exceptions, so we should look at improving it.

Basically, parameters for the result are first set via setters on the
Result object itself. If they don't exist, an exception is thrown and
ignored. ServletRedirectResult and ServletActionRedirectResult both use
params to mean "query string/url parameters" as opposed to properties on
the Result object, so when using params on ServletRedirectResult or
ServletActionRedirectResult, the exception is expected and acceptable.

Brad Cupit
Louisiana State University - UIS

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


RE: Redirect-Action type result warns of caught exception when passing param

by KonTiki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Brad,

Excellent! Precise and clear.

Regards,
Kety.

Brad A Cupit wrote:
> I'm of the opinion that an exception in my
> console means something is amiss though...

you've stumbled upon a little wart in the code. First things first, the
exception is harmless and can be safely ignored.

A more detailed explanation can be found in a comment within
ObjectFactory.buildResult(..), posted below (slightly reformatted):

// ognl exceptions could be thrown and be ok if, for example, the result
// uses parameters in ways other than as properties for the result
object.
// For example, the redirect result from Struts 2 allows any parameters
// to be set on the result, which it appends to the redirecting url.
// These parameters wouldn't have a corresponding setter on the result
// object, so an OGNL exception could be thrown.  Still, this is a
misuse
// of exceptions, so we should look at improving it.

Basically, parameters for the result are first set via setters on the
Result object itself. If they don't exist, an exception is thrown and
ignored. ServletRedirectResult and ServletActionRedirectResult both use
params to mean "query string/url parameters" as opposed to properties on
the Result object, so when using params on ServletRedirectResult or
ServletActionRedirectResult, the exception is expected and acceptable.

Brad Cupit
Louisiana State University - UIS

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org