struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rainer Hermanns" <herma...@aixcept.de>
Subject Re: Need verification of complex patch
Date Wed, 18 Jun 2008 08:06:44 GMT
Kristin,

could you please attach this as unified patch to the related Jira issue?
I'll look into this during the week and apply the patch, if everything
is working properly.
It would be very helpful, if you have a unit test available, that verifies
the correct behaviour.

thanks,
Rainer

> I have a patch for http://jira.opensymphony.com/browse/XW-604 and
> another issue that i am experiencing. The patch somewhat changes the
> behaviour of the exception flow and I would like a small review:
>
> Problem I am fixing:
>  DefaultActionInvocation.invoke() invokes entire interceptor chain and
> calls invokeActionOnly with the full chain on the stack.
>  invokeActionOnly returns success.
>  executeResult is invoked and throws an exception (in XW-604 it is
> "beforeResult" that throws an exception but with the same effect.)
>  Call stack unwinds to ExceptionMappingInterceptor.
>  When ExceptionMappingInterceptor completes, executed is actually FALSE
> in the DefaultActionInvocation, meaning that executeResult will be
> invoked *again* (with exception again).
>  The stacktrace that flows to the top is actually from the last
> exception, and the symptom is that there are no interceptors on the
> stacktrace.
>
> My patch is really very simple, i just moved executed=true to the top of
> the block, like this:
>
>     		// this is needed because the result will be executed,
> then control will return to the Interceptor, which will
>     		// return above and flow through again
>     		if (!executed) {
>              executed = true; // Flag as executed, no matter what
> happens below.  // THIS IS THE PATCH. Used to be at the bottom of the if
> block.
>
>              if (preResultListeners != null) {
>     				for (Iterator iterator =
> preResultListeners.iterator();
>     					iterator.hasNext();) {
>     					PreResultListener listener =
> (PreResultListener) iterator.next();
>
>     					String
> _profileKey="preResultListener: ";
>     					try {
>
> UtilTimerStack.push(_profileKey);
>
> listener.beforeResult(this, resultCode);
>     					}
>     					finally {
>
> UtilTimerStack.pop(_profileKey);
>     					}
>     				}
>     			}
>
>     			// now execute the result, if we're supposed to
>              if (proxy.getExecuteResult()) {
>                executeResult();
>              }
>           }
>
>
>
>
> I believe there are no thread safety issues here.
>
> Comments ?
>
> Kristian Rosenvold
>


-- 
Rainer Hermanns
aixcept
Mariahilfstrasse 9
52062 Aachen - Germany
w: http://aixcept.de/
t: +49-241-4012247
m: +49-170-3432912

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


Mime
View raw message