cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject svn commit: r1552726 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
Date Fri, 20 Dec 2013 16:43:07 GMT
Author: ashakirin
Date: Fri Dec 20 16:43:07 2013
New Revision: 1552726

URL: http://svn.apache.org/r1552726
Log:
[CXF-5473] JAX-RS schema validation: interpret schema loading problems as exceptions instead
warnings

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java?rev=1552726&r1=1552725&r2=1552726&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
Fri Dec 20 16:43:07 2013
@@ -28,7 +28,6 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.logging.Logger;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
@@ -41,7 +40,6 @@ import org.w3c.dom.ls.LSResourceResolver
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.catalog.OASISCatalogManager;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ClasspathScanner;
 import org.apache.cxf.common.xmlschema.LSInputImpl;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
@@ -51,8 +49,6 @@ public class SchemaHandler {
 
     static final String DEFAULT_CATALOG_LOCATION = "classpath:META-INF/jax-rs-catalog.xml";
     
-    private static final Logger LOG = LogUtils.getL7dLogger(SchemaHandler.class);
-    
     private Schema schema;
     private Bus bus;
     private String catalogLocation;
@@ -100,6 +96,9 @@ public class SchemaHandler {
                         schemaURLs.add(url);
                     }
                 }
+                if (schemaURLs.isEmpty()) {
+                    throw new IllegalArgumentException("Cannot find XML schema location:
" + loc);
+                }
                 for (URL schemaURL : schemaURLs) {
                     Reader r = new BufferedReader(
                                    new InputStreamReader(schemaURL.openStream(), "UTF-8"));
@@ -147,13 +146,13 @@ public class SchemaHandler {
                             
                         });
                     } catch (IOException ex) {
-                        LOG.warning("Catalog " + catalogLocation + " can not be loaded");
+                        throw new IllegalArgumentException("Catalog " + catalogLocation +
" can not be loaded", ex);
                     }
                 }
             }
             s = factory.newSchema(sources.toArray(new Source[sources.size()]));
         } catch (Exception ex) {
-            LOG.warning("Validation will be disabled, failed to create schema : " + ex.getMessage());
+            throw new IllegalArgumentException("Failed to load XML schema : " + ex.getMessage(),
ex);
         }
         return s;
         



Mime
View raw message