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

Gavin King gavin.king at jboss.com
Sat Feb 3 23:13:34 EST 2007


  User: gavin   
  Date: 07/02/03 23:13:34

  Modified:    src/main/org/jboss/seam/jsf   AbstractSeamPhaseListener.java
                        SeamPhaseListener.java
  Log:
  tx handling for stuff that happens in phaselistener
  
  Revision  Changes    Path
  1.38      +3 -12     jboss-seam/src/main/org/jboss/seam/jsf/AbstractSeamPhaseListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractSeamPhaseListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/jsf/AbstractSeamPhaseListener.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -b -r1.37 -r1.38
  --- AbstractSeamPhaseListener.java	26 Jan 2007 05:28:51 -0000	1.37
  +++ AbstractSeamPhaseListener.java	4 Feb 2007 04:13:34 -0000	1.38
  @@ -11,6 +11,7 @@
   import org.jboss.seam.log.LogProvider;
   import org.jboss.seam.log.Logging;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.TransactionException;
   import org.jboss.seam.contexts.Context;
   import org.jboss.seam.contexts.ContextAdaptor;
   import org.jboss.seam.contexts.Contexts;
  @@ -241,14 +242,6 @@
            actionsWereCalled = Pages.instance().enterPage( event.getFacesContext() );
            return actionsWereCalled;
         }
  -      catch (RuntimeException re)
  -      {
  -         //we have to handle exceptions here because of
  -         //how JSF defines exception handling from
  -         //PhaseListener.beforePhase()
  -         log.error("Swallowing exception thrown by page action", re);
  -         return actionsWereCalled;
  -      }
         finally
         {
            Lifecycle.setPhaseId( PhaseId.RENDER_RESPONSE );
  @@ -282,8 +275,7 @@
         }
         catch (Exception e)
         {
  -         //TODO: what should we *really* do here??
  -         throw new IllegalStateException("Could not start transaction", e);
  +         throw new TransactionException("Could not start transaction", e);
         }
      }
      void commitOrRollback(PhaseId phaseId) {
  @@ -302,8 +294,7 @@
         }
         catch (Exception e)
         {
  -         //TODO: what should we *really* do here??
  -         throw new IllegalStateException("Could not commit transaction", e);
  +         throw new TransactionException("Could not commit transaction", e);
         }
      }
      protected void afterProcessValidations(FacesContext facesContext)
  
  
  
  1.97      +81 -46    jboss-seam/src/main/org/jboss/seam/jsf/SeamPhaseListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SeamPhaseListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/jsf/SeamPhaseListener.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -b -r1.96 -r1.97
  --- SeamPhaseListener.java	21 Dec 2006 02:38:27 -0000	1.96
  +++ SeamPhaseListener.java	4 Feb 2007 04:13:34 -0000	1.97
  @@ -18,6 +18,7 @@
   import org.jboss.seam.log.LogProvider;
   import org.jboss.seam.log.Logging;
   import org.jboss.seam.contexts.Lifecycle;
  +import org.jboss.seam.core.Exceptions;
   import org.jboss.seam.core.FacesMessages;
   
   /**
  @@ -41,6 +42,9 @@
         
         Lifecycle.setPhaseId( event.getPhaseId() );
   
  +      try
  +      {
  +         
         //delegate to subclass:
         handleTransactionsBeforePhase(event);
         
  @@ -60,12 +64,29 @@
         super.beforePhase(event);
   
      }
  +      catch (Exception e)
  +      {
  +         log.error("uncaught exception", e);
  +         try
  +         {
  +            Exceptions.instance().handle(e);
  +         }
  +         catch (Exception ehe) 
  +         {
  +            log.error("swallowing exception", e);
  +         }
  +      }
  +
  +   }
      
      @Override
      public void afterPhase(PhaseEvent event)
      {
         log.trace( "after phase: " + event.getPhaseId() );
         
  +      try
  +      {
  +         
         super.afterPhase(event);
   
         FacesContext facesContext = event.getFacesContext();
  @@ -99,6 +120,20 @@
            afterResponseComplete(facesContext);
         }
         
  +      }
  +      catch (Exception e)
  +      {
  +         log.error("uncaught exception", e);
  +         try
  +         {
  +            Exceptions.instance().handle(e);
  +         }
  +         catch (Exception ehe) 
  +         {
  +            log.error("swallowing exception", e);
  +         }
  +      }
  +
         Lifecycle.setPhaseId(null);
         
      }
  
  
  



More information about the jboss-cvs-commits mailing list