You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/02/07 17:31:54 UTC

svn commit: r619487 - /cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java

Author: reinhard
Date: Thu Feb  7 08:31:52 2008
New Revision: 619487

URL: http://svn.apache.org/viewvc?rev=619487&view=rev
Log:
fix a rather obscure problem with per-pipeline error handlers:
  If there is a per-pipeline handler in the last! pipeline of a sitemap,
  it also handled ResourceNotFoundExceptions although it is not responsible for it.
The solution is to move throwing this exception outside of the catch section which is responsible for catching pipeline errors.

(see http://marc.info/?l=xml-cocoon-dev&m=120164177305276&w=2)

Modified:
    cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java

Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java?rev=619487&r1=619486&r2=619487&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java Thu Feb  7 08:31:52 2008
@@ -130,16 +130,11 @@
                 // Reset internal error handler (previous pipeline might had set it)
                 context.setErrorHandler(null);
             }
-
             if (invokeNodes(children, env, context)) {
                 return true;
             } else if (!this.isLast) {
                 return false;
             }
-
-            throw new ResourceNotFoundException("No pipeline matched request: " +
-                                                env.getURIPrefix() + env.getURI());
-
         } catch (ConnectionResetException e) {
             // Will be reported by CocoonServlet, rethrowing
             throw e;
@@ -147,5 +142,10 @@
             // Invoke error handler
             return this.errorHandlerHelper.invokeErrorHandler(e, env, context);
         }
+
+        // if nothing has matched and it is the last pipeline, then it's the right time
+        // to throw an ResourceNotFoundException
+        throw new ResourceNotFoundException("No pipeline matched request: " +
+                env.getURIPrefix() + env.getURI());
     }
 }