This content has been marked as final.
Show 4 replies
-
1. Re: Debug page intercepts handled exceptions in 1.1
gavin.king Nov 28, 2006 4:18 PM (in response to rbz285)when I debugged it I found that the contextData on the invocationContext was different on the call to the second bean than on the initial JSF call to the first bean so the outermost flag was true in both cases.
Ah. Good point. That's a bug.
http://jira.jboss.com/jira/browse/JBSEAM-534 -
2. Re: Debug page intercepts handled exceptions in 1.1
rbz285 Nov 29, 2006 7:29 AM (in response to rbz285)thanks, I've just tried the fix using the 20061129 nightly build that has the change in it but it doesn't work for me, it still shows the debug page
I've checked that the download includes the source changestatic ThreadLocal marker = new ThreadLocal(); @AroundInvoke public Object handleExceptions(InvocationContext invocation) throws Exception { boolean outermost = marker.get() == null; marker.set(this); try { return invocation.proceed(); } catch (Exception e) { if (outermost && FacesContext.getCurrentInstance()!=null) { return Exceptions.instance().handle(e); } else { throw e; } } finally { marker.remove(); } }
I reckon it doesn't work for me because my first bean actually calls 2 different methods on my second bean and so the above code calls marker.remove() after the first call to the second bean, hence the next call is treated as the outermost.
It would probably be better to only bother with the exception logic if its actually going to be used, something like:@AroundInvoke public Object handleExceptions(InvocationContext invocation) throws Exception { boolean outermost = marker.get() == null; if (outermost) { marker.set(this); try { return invocation.proceed(); } catch (Exception e) { if (FacesContext.getCurrentInstance()!=null) { return Exceptions.instance().handle(e); } else { throw e; } } finally { marker.remove(); } } else { return invocation.proceed(); } }
what do you reckon ? -
3. Re: Debug page intercepts handled exceptions in 1.1
gavin.king Nov 29, 2006 7:50 AM (in response to rbz285)Try again, I just fixed the fix.
-
4. Re: Debug page intercepts handled exceptions in 1.1
rbz285 Nov 29, 2006 10:30 AM (in response to rbz285)it works for me now
thanks