killbill-uncached

Updating catalog to skip verification (with a nasty log message)

11/2/2011 6:26:14 PM

Details

diff --git a/catalog/src/main/java/com/ning/billing/catalog/io/XMLReader.java b/catalog/src/main/java/com/ning/billing/catalog/io/XMLReader.java
index 1f568ea..c0e5b2e 100644
--- a/catalog/src/main/java/com/ning/billing/catalog/io/XMLReader.java
+++ b/catalog/src/main/java/com/ning/billing/catalog/io/XMLReader.java
@@ -27,6 +27,8 @@ import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
 import com.ning.billing.catalog.Catalog;
@@ -34,18 +36,23 @@ import com.ning.billing.catalog.ValidatingConfig.ValidationErrors;
 import com.ning.billing.catalog.api.InvalidConfigException;
 
 public class XMLReader {
-
+	public static Logger log = LoggerFactory.getLogger(XMLReader.class);
 
     public static Catalog getCatalogFromName(URL url) throws SAXException, InvalidConfigException, JAXBException {
         JAXBContext context =JAXBContext.newInstance(Catalog.class);
 
         InputStream resourceStream = XMLReader.class.getResourceAsStream("/CatalogSchema.xsd");
         SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI );
-        Schema schema = factory.newSchema(new StreamSource(resourceStream));
-
         Unmarshaller um = context.createUnmarshaller();
-        um.setSchema(schema);
-
+        
+        if(resourceStream == null) {
+        	log.error("Can't find XML Schema resource to validate content - if you are seeing " +
+        			"this as part of the release build process its OK to ignore, otherwie it needs attention");
+        } else {
+        	Schema schema = factory.newSchema(new StreamSource(resourceStream));
+            um.setSchema(schema);
+       }
+        
         Object o = um.unmarshal(url);
 
         if(o instanceof Catalog) {