Just in case, install an error handler to log anything that's raised.
authorcantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 21 Jul 2005 03:02:50 +0000 (03:02 +0000)
committercantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 21 Jul 2005 03:02:50 +0000 (03:02 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1735 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/xml/SchemaStore.java

index de2252f..4cc19ac 100644 (file)
@@ -35,7 +35,9 @@ import javax.xml.validation.SchemaFactory;
 
 import org.apache.log4j.Logger;
 import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
 
 /**
  * Compile a Schema object from a Map of DOM objects representing XSD files keyed by the Namespace that the XSD defines.
@@ -45,7 +47,7 @@ import org.xml.sax.SAXException;
  * 
  * @author Howard Gilbert
  */
-public class SchemaStore {
+public class SchemaStore implements ErrorHandler {
 
        private static Logger log = Logger.getLogger(SchemaStore.class);
 
@@ -108,6 +110,7 @@ public class SchemaStore {
                // Now compile all the XSD files into a single composite Schema object
                SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                try {
+                       factory.setErrorHandler(this);
                        schema = factory.newSchema((Source[]) sources.toArray(new Source[0]));
                } catch (SAXException e) {
                        log.error("Schemas failed to compile, dependencies may be corrupt: " + e);
@@ -115,4 +118,19 @@ public class SchemaStore {
                return schema;
        }
 
+       public void warning(SAXParseException exception) throws SAXException {
+               log.warn(exception);
+               
+       }
+
+       public void error(SAXParseException exception) throws SAXException {
+               log.error(exception);
+               throw exception;
+       }
+
+       public void fatalError(SAXParseException exception) throws SAXException {
+               log.error(exception);
+               throw exception;
+       }
+
 }