[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...

Norman Richards norman.richards at jboss.com
Tue Nov 28 20:30:12 EST 2006


  User: nrichards
  Date: 06/11/28 20:30:12

  Modified:    src/main/org/jboss/seam/interceptors 
                        ExceptionInterceptor.java
  Log:
  JBSEAM-534: use threadlocal instead of invocation context for marker
  
  Revision  Changes    Path
  1.13      +19 -24    jboss-seam/src/main/org/jboss/seam/interceptors/ExceptionInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ExceptionInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ExceptionInterceptor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- ExceptionInterceptor.java	1 Nov 2006 02:54:02 -0000	1.12
  +++ ExceptionInterceptor.java	29 Nov 2006 01:30:12 -0000	1.13
  @@ -1,4 +1,4 @@
  -//$Id: ExceptionInterceptor.java,v 1.12 2006/11/01 02:54:02 gavin Exp $
  +//$Id: ExceptionInterceptor.java,v 1.13 2006/11/29 01:30:12 nrichards Exp $
   package org.jboss.seam.interceptors;
   
   import javax.faces.context.FacesContext;
  @@ -17,28 +17,23 @@
   @Interceptor(stateless=true, type=InterceptorType.CLIENT)
   public class ExceptionInterceptor extends AbstractInterceptor
   {
  +    static ThreadLocal marker = new ThreadLocal();
   
      @AroundInvoke
      public Object handleExceptions(InvocationContext invocation) throws Exception
      {
  -      boolean outermost = invocation.getContextData().get("org.jboss.seam.outermostExceptionInterceptor")==null;
  -      invocation.getContextData().put("org.jboss.seam.outermostExceptionInterceptor", true);
  -      try
  -      {
  +        boolean outermost = marker.get() == null;
  +        marker.set(this);
  +        try  {
            return invocation.proceed();
  -      }
  -      catch (Exception e)
  -      {
  -         if ( outermost && FacesContext.getCurrentInstance()!=null )
  -         {
  +        } catch (Exception e) {
  +            if (outermost && FacesContext.getCurrentInstance()!=null) {
               return Exceptions.instance().handle(e);
  -         }
  -         else
  -         {
  +            } else {
               throw e;
            }
  +        } finally {
  +            marker.remove();
         }
      }
  -
  -
   }
  
  
  



More information about the jboss-cvs-commits mailing list