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

Gavin King gavin.king at jboss.com
Sun Feb 4 01:57:41 EST 2007


  User: gavin   
  Date: 07/02/04 01:57:41

  Modified:    src/main/org/jboss/seam/core  Exceptions.java
  Log:
  improve
  
  Revision  Changes    Path
  1.27      +20 -13    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.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- Exceptions.java	4 Feb 2007 05:41:58 -0000	1.26
  +++ Exceptions.java	4 Feb 2007 06:57:40 -0000	1.27
  @@ -7,6 +7,7 @@
   import java.util.ArrayList;
   import java.util.List;
   
  +import org.dom4j.DocumentException;
   import org.dom4j.Element;
   import org.jboss.seam.Component;
   import org.jboss.seam.ScopeType;
  @@ -76,11 +77,25 @@
      @Create
      public void initialize() throws Exception 
      {
  -      String fileName = "/WEB-INF/exceptions.xml";
  -      InputStream stream = Resources.getResourceAsStream(fileName); //deprecated
  -      fileName = "/WEB-INF/pages.xml";
  -      if (stream==null) stream = Resources.getResourceAsStream(fileName);
  +      ExceptionHandler anyhandler1 = parse("/WEB-INF/exceptions.xml"); //deprecated
  +      ExceptionHandler anyhandler2 = parse("/WEB-INF/pages.xml");
  +      
  +      exceptionHandlers.add( new AnnotationRedirectHandler() );
  +      exceptionHandlers.add( new AnnotationErrorHandler() );
  +      
  +      if ( Init.instance().isDebug() ) 
  +      {
  +         exceptionHandlers.add( new DebugPageHandler() );
  +      }
  +      
  +      if (anyhandler1!=null) exceptionHandlers.add(anyhandler1);
  +      if (anyhandler2!=null) exceptionHandlers.add(anyhandler2);
  +   }
  +
  +   private ExceptionHandler parse(String fileName) throws DocumentException, ClassNotFoundException
  +   {
         ExceptionHandler anyhandler = null;
  +      InputStream stream = Resources.getResourceAsStream(fileName);
         if (stream!=null)
         {
            log.info("reading exception mappings from " + fileName);
  @@ -99,15 +114,7 @@
               }
            }
         }
  -      
  -      exceptionHandlers.add( new AnnotationRedirectHandler() );
  -      exceptionHandlers.add( new AnnotationErrorHandler() );
  -      if ( Init.instance().isDebug() ) 
  -      {
  -         exceptionHandlers.add( new DebugPageHandler() );
  -      }
  -      
  -      if (anyhandler!=null) exceptionHandlers.add(anyhandler);
  +      return anyhandler;
      }
   
      private ExceptionHandler createHandler(Element exception, final Class clazz)
  
  
  



More information about the jboss-cvs-commits mailing list