[jboss-user] [JBoss Seam] - Re: Debug page intercepts handled exceptions in 1.1

rbz285 do-not-reply at jboss.com
Wed Nov 29 07:29:02 EST 2006


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 change 


  |     static 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 ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989667#3989667

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989667



More information about the jboss-user mailing list