You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/08/14 16:03:54 UTC
[jira] Resolved: (TAPESTRY-433) throwing PageRedirectException in pageValidate() doesn't work
[ http://issues.apache.org/jira/browse/TAPESTRY-433?page=all ]
Howard M. Lewis Ship resolved TAPESTRY-433:
-------------------------------------------
Fix Version: 4.0
Resolution: Cannot Reproduce
Assign To: Howard M. Lewis Ship
I don't think this bug was ever valid for pageValidate(). I did re-work a bit of how listener methods worked in beta-4 that may account for this no longer being reproducable.
To be sure, I built a small "scratch pad" to test throwing PageRedirectException from both pageValidate() and from a listener method. Both worked exactly as they should.
> throwing PageRedirectException in pageValidate() doesn't work
> -------------------------------------------------------------
>
> Key: TAPESTRY-433
> URL: http://issues.apache.org/jira/browse/TAPESTRY-433
> Project: Tapestry
> Type: Bug
> Components: Framework
> Versions: 4.0
> Environment: Windows XP
> Reporter: Kent Tong
> Assignee: Howard M. Lewis Ship
> Fix For: 4.0
>
> Throwing a PageRedirectException in pageValidate() won't redirect to the specified page. Instead, it will cause Tapestry to report an exception. The bug is in ListenerMethodInvokerImpl.java as shown below:
> public class ListenerMethodInvokerImpl implements ListenerMethodInvoker {
> private void invokeListenerMethod(Method listenerMethod, Object target, boolean includeCycle,
> boolean includeParameters, IRequestCycle cycle, Object[] listenerParameters)
> {
> Object[] parameters = new Object[listenerMethod.getParameterTypes().length];
> int cursor = 0;
> if (includeCycle)
> parameters[cursor++] = cycle;
> if (includeParameters)
> for (int i = 0; i < Tapestry.size(listenerParameters); i++)
> parameters[cursor++] = listenerParameters[i];
> try
> {
> Object methodResult = invokeTargetMethod(target, listenerMethod, parameters);
> // void methods return null
> if (methodResult == null)
> return;
> // The method scanner, inside ListenerMapSourceImpl,
> // ensures that only methods that return void, String,
> // or assignable to IPage are considered.
> if (methodResult instanceof String)
> {
> cycle.activate((String) methodResult); //Step 1: If this throws a PageRedirectException, then...
> return;
> }
> cycle.activate((IPage) methodResult);
> }
> catch (InvocationTargetException ex) //Step2: It will NOT be caught here!
> {
> Throwable targetException = ex.getTargetException();
> if (targetException instanceof ApplicationRuntimeException)
> throw (ApplicationRuntimeException) targetException;
> throw new ApplicationRuntimeException(ListenerMessages.listenerMethodFailure(
> listenerMethod,
> target,
> targetException), target, null, targetException);
> }
> catch (Exception ex) //Step 3: It will be caught here!
> {
> throw new ApplicationRuntimeException(ListenerMessages.listenerMethodFailure(
> listenerMethod,
> target,
> ex), target, null, ex);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org