cziegeler    02/02/12 23:03:15

  Modified:    src/java/org/apache/cocoon/generation FileGenerator.java
  Log:
  Don't wrap original exception again if it is throwable
  
  Revision  Changes    Path
  1.6       +16 -18    
xml-cocoon2/src/java/org/apache/cocoon/generation/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/FileGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FileGenerator.java        12 Feb 2002 16:32:34 -0000      1.5
  +++ FileGenerator.java        13 Feb 2002 07:03:15 -0000      1.6
  @@ -54,8 +54,6 @@
    */
   package org.apache.cocoon.generation;
   
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.caching.CacheValidity;
  @@ -79,7 +77,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: FileGenerator.java,v 1.5 2002/02/12 16:32:34 vgritsenko Exp $
  + * @version CVS $Id: FileGenerator.java,v 1.6 2002/02/13 07:03:15 cziegeler Exp $
    */
   public class FileGenerator extends ComposerGenerator
   implements Cacheable {
  @@ -88,14 +86,6 @@
       protected Source inputSource;
   
       /**
  -     * Set the current <code>ComponentManager</code> instance used by this
  -     * <code>Composable</code>.
  -     */
  -    public void compose(ComponentManager manager) throws ComponentException {
  -        super.compose(manager);
  -    }
  -
  -    /**
        * Recycle this component.
        * All instance variables are set to <code>null</code>.
        */
  @@ -149,21 +139,29 @@
       public void generate()
       throws IOException, SAXException, ProcessingException {
           try {
  -            getLogger().debug("processing file " + super.source);
  -            getLogger().debug("file resolved to " + this.inputSource.getSystemId());
  -
  +            if (this.getLogger().isDebugEnabled()) {
  +                this.getLogger().debug("processing file " + super.source);
  +                this.getLogger().debug("file resolved to " + 
this.inputSource.getSystemId());
  +            }
               this.inputSource.toSAX(super.xmlConsumer);
           } catch (ProcessingException e) {
               throw e;
           } catch (SAXException e) {
  -            if(e.getException() != null) {
  -                getLogger().debug("Got SAXException; Rethrowing cause exception", 
e);
  +            final Exception cause = e.getException();
  +            if( cause != null ) {
  +                this.getLogger().debug("Got SAXException; Rethrowing cause 
exception", e);
  +                if ( cause instanceof ProcessingException )
  +                    throw (ProcessingException)cause;
  +                if ( cause instanceof IOException )
  +                    throw (IOException)cause;
  +                if ( cause instanceof SAXException )
  +                    throw (SAXException)cause;
                   throw new ProcessingException("Could not read resource "
  -                                              + this.inputSource.getSystemId(), 
e.getException());
  +                                              + this.inputSource.getSystemId(), 
cause);
               }
               throw e;
           } catch (Exception e) {
  -            getLogger().error("Could not read resource "
  +            this.getLogger().error("Could not read resource "
                                 + this.inputSource.getSystemId(), e);
               throw new ProcessingException("Could not read resource "
                                             + this.inputSource.getSystemId(), e);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to