coliver 2003/04/05 22:39:01
Modified: src/scratchpad/src/org/apache/cocoon/transformation JXPathTransformer.java Log: don't lose line numbers in errors when running as a generator Revision Changes Path 1.6 +11 -6 cocoon-2.1/src/scratchpad/src/org/apache/cocoon/transformation/JXPathTransformer.java Index: JXPathTransformer.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/transformation/JXPathTransformer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- JXPathTransformer.java 6 Apr 2003 05:00:13 -0000 1.5 +++ JXPathTransformer.java 6 Apr 2003 06:39:01 -0000 1.6 @@ -76,6 +76,7 @@ import org.w3c.dom.DocumentFragment; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; import org.xml.sax.helpers.AttributesImpl; /** * JXPath Transformer @@ -154,16 +155,20 @@ try { this.resolver.toSAX(this.inputSource, this); } catch (SAXException e) { + if (e instanceof SAXParseException) { + throw e; + } final Exception cause = e.getException(); - if( cause != null ) { - if ( cause instanceof ProcessingException ) + if (cause != null) { + if (cause instanceof ProcessingException) throw (ProcessingException)cause; - if ( cause instanceof IOException ) + if (cause instanceof IOException) throw (IOException)cause; - if ( cause instanceof SAXException ) + if (cause instanceof SAXException) throw (SAXException)cause; - throw new ProcessingException("Could not read resource " - + this.inputSource.getURI(), cause); + throw new ProcessingException("Error reading resource " + + this.inputSource.getURI(), + cause); } throw e; }