cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: svn commit: r226838 - in /cocoon/branches/BRANCH_2_1_X: src/java/org/apache/cocoon/transformation/TraxTransformer.java status.xml
Date Wed, 03 Aug 2005 12:58:45 GMT
sylvain@apache.org wrote:
> Author: sylvain
> Date: Mon Aug  1 09:52:50 2005
> New Revision: 226838
> 
> URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java?rev=226838&r1=226837&r2=226838&view=diff
> ==============================================================================
> --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java
(original)
> +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java
Mon Aug  1 09:52:50 2005
> @@ -575,7 +610,30 @@
>       */
>      public void endDocument()
>      throws SAXException {
> -        super.endDocument();
> +        try {
> +            super.endDocument();
> +        } catch(SAXException se) {
> +            // Rethrow
> +            throw se;

Nitpicking... Shouldn't this be:


> +        } catch(Exception e) {

   +        } catch(RuntimeException e) {


> +            if (transformerException != null) {
> +                // Ignore the fake RuntimeException sent by Xalan
> +                Location loc = ExceptionUtils.getLocation(transformerException);
> +                if (loc == null) {
> +                    // No location: if it's just a wrapper, consider only the wrapped
exception.
> +                    Throwable realEx = transformerException.getCause();
> +                    if (realEx == null) realEx = transformerException;
> +                    
> +                    // Now throw an exception locating the current stylesheet
> +                    throw new LocatedRuntimeException("Error during transformation",
realEx, new Location(this.inputSource.getURI()));
> +                } else {
> +                    throw new SAXException(transformerException);
> +                }
> +            } else {
> +                // It's not a fake exception
> +                throw new SAXException(e);

   +                throw e;

It's better to preserve original (non xalan) RuntimeException, than to wrap it. 
WDYT?

Vadim


> +            }
> +        }
>          this.finishedDocument = true;
>      }

Mime
View raw message