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

Gavin King gavin.king at jboss.com
Wed Nov 8 16:30:13 EST 2006


  User: gavin   
  Date: 06/11/08 16:30:13

  Modified:    src/main/org/jboss/seam/core  Exceptions.java
  Log:
  substitute for @ApplicationException JBSEAM-467
  
  Revision  Changes    Path
  1.9       +20 -1     jboss-seam/src/main/org/jboss/seam/core/Exceptions.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Exceptions.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Exceptions.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- Exceptions.java	8 Nov 2006 19:54:52 -0000	1.8
  +++ Exceptions.java	8 Nov 2006 21:30:13 -0000	1.9
  @@ -30,6 +30,7 @@
   import org.jboss.seam.util.Reflections;
   import org.jboss.seam.util.Resources;
   import org.jboss.seam.util.Strings;
  +import org.jboss.seam.util.Transactions;
   
   /**
    * Holds metadata for pages defined in pages.xml, including
  @@ -211,6 +212,7 @@
         {
            addFacesMessage( e, getMessage(e) );
            if ( isEnd(e) ) Conversation.instance().end();
  +         if ( isRollback(e) ) Transactions.setTransactionRollbackOnly();
            redirect( getViewId(e) );
            return rethrow(e);
         }
  @@ -236,6 +238,11 @@
            return e.getClass().getAnnotation(Redirect.class).end();
         } 
   
  +      protected boolean isRollback(Exception e)
  +      {
  +         return e.getClass().getAnnotation(HttpError.class).rollback();
  +      }
  +      
         @Override
         public String toString()
         {
  @@ -245,10 +252,11 @@
      
      public static class RenderHandler implements ExceptionHandler
      {
  -      public Object handle(Exception e)
  +      public Object handle(Exception e) throws Exception
         {
            addFacesMessage( e, getMessage(e) );
            if ( isEnd(e) ) Conversation.instance().end();
  +         if ( isRollback(e) ) Transactions.setTransactionRollbackOnly();
            render( getViewId(e) );
            return null;
         }
  @@ -274,6 +282,11 @@
            return e.getClass().getAnnotation(Render.class).end();
         }
   
  +      protected boolean isRollback(Exception e)
  +      {
  +         return e.getClass().getAnnotation(HttpError.class).rollback();
  +      }
  +      
         @Override
         public String toString()
         {
  @@ -286,6 +299,7 @@
         public Object handle(Exception e) throws Exception
         {
            if ( isEnd(e) ) Conversation.instance().end();
  +         if ( isRollback(e) ) Transactions.setTransactionRollbackOnly();
            String message = getMessage(e);
            //addFacesMessage(e, message);
            error( getCode(e), Interpolator.instance().interpolate( getDisplayMessage(e, message) ) );
  @@ -312,6 +326,11 @@
            return e.getClass().getAnnotation(HttpError.class).end();
         }
         
  +      protected boolean isRollback(Exception e)
  +      {
  +         return e.getClass().getAnnotation(HttpError.class).rollback();
  +      }
  +      
         @Override
         public String toString()
         {
  
  
  



More information about the jboss-cvs-commits mailing list