+ Throwable t = ExceptionFunctions.traceCauseException(e);
+
+ if (t instanceof XMLReaderExc) {
+ if (locator!=null && filename!=null)
+ ((XMLReaderExc) t).setLocation(filename, locator.getLineNumber(), locator.getColumnNumber());
+ throw (XMLReaderExc) t;
+ }
+
+ if (t instanceof SAXParseException) {
+ XMLReaderExc r = new XMLReaderExc(t.getMessage());
+
+ if (locator!=null && filename!=null)
+ r.setLocation(filename, locator.getLineNumber(), locator.getColumnNumber());
+
+ throw r;
+ }
+
+ if (t instanceof XMLReaderFailure) {
+ throw (XMLReaderFailure) t;
+ }
+
+ if (t instanceof ParserConfigurationException) {
+ throw new XMLReaderFailure("Internal exception: "+t.toString(), t);
+ }
+
+ throw new XMLReaderFailure(t);