You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by pi...@apache.org on 2003/02/23 00:22:33 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor DefaultTreeBuilder.java

pier        2003/02/22 15:22:32

  Modified:    src/java/org/apache/cocoon/components/treeprocessor
                        DefaultTreeBuilder.java
  Log:
  In a sitemap where we use something like
  
    <map:match pattern="*/**">
      <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/>
    </map:match>
  
  the DefaultTreeBuilder catches the correctly generated ResourceNotFoundException
  and re-throws it nested in a ProcessingException. This will make Cocoon return
  an HTTP error 500 to the client, instead of a more-appropriate 404.
  
  This patch will solve this by simply avoiding to nest ProcessingException(s) or
  their subclasses, simply throwing them back as caught.
  
  Revision  Changes    Path
  1.18      +5 -3      xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/DefaultTreeBuilder.java
  
  Index: DefaultTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/DefaultTreeBuilder.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultTreeBuilder.java	31 Jan 2003 22:51:36 -0000	1.17
  +++ DefaultTreeBuilder.java	22 Feb 2003 23:22:32 -0000	1.18
  @@ -379,7 +379,8 @@
           return this.namespace;
       }
   
  -    public ProcessingNode build(Source source) throws Exception {
  +    public ProcessingNode build(Source source)
  +    throws Exception {
   
           try {
               // Build a namespace-aware configuration object
  @@ -388,7 +389,8 @@
               Configuration treeConfig = handler.getConfiguration();
   
               return build(treeConfig);
  -
  +        } catch (ProcessingException e) {
  +            throw e;
           } catch(Exception e) {
               throw new ProcessingException("Failed to load " + this.languageName + " from " +
                   source.getURI(), e);