You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2001/11/20 22:56:54 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/util ErrorHandlerWrapper.java
neilg 01/11/20 13:56:54
Modified: java/src/org/apache/xerces/util ErrorHandlerWrapper.java
Log:
fix a problem where we would happily throw away any SAXException a user emitted from any SAX ErrorHandler event, and return the SAXParseException passed in to the call instead.
Revision Changes Path
1.3 +21 -5 xml-xerces/java/src/org/apache/xerces/util/ErrorHandlerWrapper.java
Index: ErrorHandlerWrapper.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/ErrorHandlerWrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorHandlerWrapper.java 2001/08/23 00:35:32 1.2
+++ ErrorHandlerWrapper.java 2001/11/20 21:56:53 1.3
@@ -77,7 +77,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: ErrorHandlerWrapper.java,v 1.2 2001/08/23 00:35:32 lehors Exp $
+ * @version $Id: ErrorHandlerWrapper.java,v 1.3 2001/11/20 21:56:53 neilg Exp $
*/
public class ErrorHandlerWrapper
implements XMLErrorHandler {
@@ -142,8 +142,11 @@
try {
fErrorHandler.warning(saxException);
}
+ catch (SAXParseException e) {
+ throw createXMLParseException(e);
+ }
catch (SAXException e) {
- throw createXMLParseException(saxException);
+ throw createXNIException(e);
}
} // warning(String,String,XMLParseException)
@@ -171,8 +174,11 @@
try {
fErrorHandler.error(saxException);
}
+ catch (SAXParseException e) {
+ throw createXMLParseException(e);
+ }
catch (SAXException e) {
- throw createXMLParseException(saxException);
+ throw createXNIException(e);
}
} // error(String,String,XMLParseException)
@@ -208,8 +214,11 @@
try {
fErrorHandler.fatalError(saxException);
}
+ catch (SAXParseException e) {
+ throw createXMLParseException(e);
+ }
catch (SAXException e) {
- throw createXMLParseException(saxException);
+ throw createXNIException(e);
}
} // fatalError(String,String,XMLParseException)
@@ -228,7 +237,7 @@
exception.getException());
} // createSAXParseException(XMLParseException):SAXParseException
- /** Creates a XMLParseException from an SAXParseException. */
+ /** Creates an XMLParseException from a SAXParseException. */
protected static XMLParseException createXMLParseException(SAXParseException exception) {
final String fPublicId = exception.getPublicId();
final String fSystemId = exception.getSystemId();
@@ -245,4 +254,11 @@
exception.getException());
} // createXMLParseException(SAXParseException):XMLParseException
+ /** Creates an XNIException from a SAXException.
+ NOTE: care should be taken *not* to call this with a SAXParseException; this will
+ lose information!!! */
+ protected static XNIException createXNIException(SAXException exception) {
+ return new XNIException(exception.getMessage(),
+ exception.getException());
+ } // createXNIException(SAXException):XMLParseException
} // class ErrorHandlerWrapper
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org