Identify bad responses coming back from the server, and throw a specific exception...
[frank.git] / prod / net / jaekl / qd / xml / ParseErrorHandler.java
diff --git a/prod/net/jaekl/qd/xml/ParseErrorHandler.java b/prod/net/jaekl/qd/xml/ParseErrorHandler.java
new file mode 100644 (file)
index 0000000..ecdb780
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (C) 2014 Christian Jaekl
+
+// Simple SAX parse error handler.
+// Necessary to avoid printing [Fatal Error] messages to stdout when something goes wrong.
+
+package net.jaekl.qd.xml;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ParseErrorHandler implements ErrorHandler {
+
+       @Override
+       public void error(SAXParseException saxpe) throws SAXException {
+               throw saxpe;
+       }
+
+       @Override
+       public void fatalError(SAXParseException saxpe) throws SAXException {
+               throw saxpe;
+       }
+
+       @Override
+       public void warning(SAXParseException saxpe) throws SAXException {
+               throw saxpe;
+       }
+
+}