cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap PipelineNode.java
Date Mon, 08 Sep 2003 18:58:01 GMT
bruno       2003/09/08 11:58:01

  Modified:    src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        PipelineNode.java
  Log:
  * Log errors handled by map:handl-errors to a separate log target.
  * Replaced tabs by spaces.
  
  Revision  Changes    Path
  1.9       +29 -25    cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
  
  Index: PipelineNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PipelineNode.java	10 Jul 2003 13:17:00 -0000	1.8
  +++ PipelineNode.java	8 Sep 2003 18:58:01 -0000	1.9
  @@ -75,8 +75,8 @@
    * @version CVS $Id$
    */
   public class PipelineNode
  -    extends AbstractParentProcessingNode
  -    implements Composable, ParameterizableProcessingNode {
  +        extends AbstractParentProcessingNode
  +        implements Composable, ParameterizableProcessingNode {
   
       // TODO : handle a 'fail-hard' environment attribute
       // can be useful to stop off-line generation when there's an error
  @@ -86,11 +86,13 @@
       private ProcessingNode error404;
   
       private ProcessingNode error500;
  -    
  +
       private ErrorHandlerHelper errorHandlerHelper = new ErrorHandlerHelper();
  -    
  +
       private ComponentManager manager;
   
  +    protected Logger handledErrorsLogger;
  +
       private boolean internalOnly = false;
   
       /** Is it the last <pipeline> in the enclosing <pipelines> ? */
  @@ -118,11 +120,11 @@
           errorHandlerHelper.compose(manager);
       }
   
  -	public void enableLogging(Logger logger)
  -	{
  -		super.enableLogging(logger);
  -		errorHandlerHelper.enableLogging(logger);
  -	}
  +    public void enableLogging(Logger logger) {
  +        super.enableLogging(logger);
  +        errorHandlerHelper.enableLogging(logger);
  +        handledErrorsLogger = logger.getChildLogger("handled-errors");
  +    }
   
       public void setChildren(ProcessingNode[] nodes) {
           this.children = nodes;
  @@ -149,8 +151,8 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -    throws Exception {
  -        
  +            throws Exception {
  +
           boolean externalRequest = env.isExternal();
   
           // Always fail on external resquests if internal only.
  @@ -172,25 +174,27 @@
           } catch (ConnectionResetException cre) {
               // Will be reported by CocoonServlet, rethrowing
               throw cre;
  -            
  -        } catch(Exception ex) {
  -            
  +
  +        } catch (Exception ex) {
  +
               if (!externalRequest) {
                   // Propagate exception on internal requests
                   throw ex;
  -                
  +
               } else if (error404 != null && ex instanceof ResourceNotFoundException)
{
  -			    // Invoke 404-specific handler
  -			    return errorHandlerHelper.invokeErrorHandler(error404, ex, env);
  -			    
  -			} else if (error500 != null) {
  +                // Invoke 404-specific handler
  +                handledErrorsLogger.error(ex.getMessage(), ex);
  +                return errorHandlerHelper.invokeErrorHandler(error404, ex, env);
  +
  +            } else if (error500 != null) {
                   // Invoke global handler
  +                handledErrorsLogger.error(ex.getMessage(), ex);
                   return errorHandlerHelper.invokeErrorHandler(error500, ex, env);
  -                
  -			} else {
  -			    // No handler : propagate
  -			    throw ex;
  -			}
  +
  +            } else {
  +                // No handler : propagate
  +                throw ex;
  +            }
           }
       }
   }
  
  
  

Mime
View raw message