vgritsenko    2003/02/02 15:19:43

  Modified:    src/java/org/apache/cocoon/environment
                        AbstractEnvironment.java
  Log:
  SAXExceptions driving me mad... Unwrap'em. Don't we have ExcUtils already? ;)
  
  Revision  Changes    Path
  1.38      +33 -15    
xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- AbstractEnvironment.java  31 Jan 2003 22:51:44 -0000      1.37
  +++ AbstractEnvironment.java  2 Feb 2003 23:19:43 -0000       1.38
  @@ -537,21 +537,39 @@
                   ContentHandler handler )
       throws SAXException, IOException, ProcessingException {
           String mimeType = source.getMimeType();
  -        if ( null == mimeType) mimeType = mimeTypeHint;
  -        if ( source instanceof org.apache.excalibur.xml.sax.XMLizable ) {
  -            ((org.apache.excalibur.xml.sax.XMLizable)source).toSAX( handler );
  -        } else if ( source instanceof org.apache.cocoon.xml.XMLizable ) {
  -            ((org.apache.cocoon.xml.XMLizable)source).toSAX( handler );
  -        } else {
  -            try {
  -                xmlizer.toSAX( source.getInputStream(),
  -                               mimeType,
  -                               source.getURI(),
  -                               handler );
  -            } catch (SourceException se) {
  -                throw SourceUtil.handle(se);
  +        if (null == mimeType) {
  +            mimeType = mimeTypeHint;
  +        }
  +
  +        try {
  +            if (source instanceof org.apache.excalibur.xml.sax.XMLizable) {
  +                ((org.apache.excalibur.xml.sax.XMLizable)source).toSAX( handler );
  +            } else if ( source instanceof org.apache.cocoon.xml.XMLizable ) {
  +                ((org.apache.cocoon.xml.XMLizable)source).toSAX( handler );
  +            } else {
  +                try {
  +                    xmlizer.toSAX( source.getInputStream(),
  +                                   mimeType,
  +                                   source.getURI(),
  +                                   handler );
  +                } catch (SourceException se) {
  +                    throw SourceUtil.handle(se);
  +                }
               }
  +        } catch (SAXException e) {
  +            final Exception cause = e.getException();
  +            if (cause != null) {
  +                if (cause instanceof ProcessingException) {
  +                    throw (ProcessingException)cause;
  +                }
  +                if (cause instanceof IOException) {
  +                    throw (IOException)cause;
  +                }
  +                if (cause instanceof SAXException) {
  +                    throw (SAXException)cause;
  +                }
  +            }
  +            throw 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