cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject svn commit: r1552738 - /cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
Date Fri, 20 Dec 2013 17:01:57 GMT
Author: ashakirin
Date: Fri Dec 20 17:01:57 2013
New Revision: 1552738

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

Modified:
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java?rev=1552738&r1=1552737&r2=1552738&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
Fri Dec 20 17:01:57 2013
@@ -27,7 +27,6 @@ import java.io.Reader;
 import java.net.URL;
 import java.util.ArrayList;
 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.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.WSDLConstants;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.xmlschema.LSInputImpl;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 
@@ -49,8 +47,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;
@@ -90,7 +86,7 @@ public class SchemaHandler {
             for (String loc : locations) {
                 URL url = ResourceUtils.getResourceURL(loc, bus);
                 if (url == null) {
-                    return null;
+                    throw new IllegalArgumentException("Cannot find XML schema location:
" + loc);
                 }
                 Reader r = new BufferedReader(
                                new InputStreamReader(url.openStream(), "UTF-8"));
@@ -134,13 +130,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