cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r633935 - /incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
Date Wed, 05 Mar 2008 17:11:24 GMT
Author: dkulp
Date: Wed Mar  5 09:11:22 2008
New Revision: 633935

URL: http://svn.apache.org/viewvc?rev=633935&view=rev
Log:
[CXF-1247] Wire the catalog resolver up to the wsdl validator stuff

Modified:
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java?rev=633935&r1=633934&r2=633935&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
(original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
Wed Mar  5 09:11:22 2008
@@ -42,6 +42,7 @@
 import org.xml.sax.InputSource;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -52,6 +53,7 @@
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.URIParserUtil;
 import org.apache.cxf.tools.validator.AbstractValidator;
+import org.apache.xml.resolver.Catalog;
 
 public class WSDL11Validator extends AbstractDefinitionValidator {
     protected static final Logger LOG = LogUtils.getL7dLogger(SchemaValidator.class);
@@ -70,9 +72,21 @@
     }
 
     private Document getWSDLDoc(String wsdl) {
-        LOG.log(Level.INFO, new Message("VALIDATE_WSDL", LOG, wsdl).toString());
+        LOG.log(Level.FINE, new Message("VALIDATE_WSDL", LOG, wsdl).toString());
         try {
-            return XMLUtils.parse(new InputSource(URIParserUtil.getAbsoluteURI(wsdl)));
+            Catalog catalogResolver = OASISCatalogManager.getCatalogManager(this.getBus()).getCatalog();
+
+            String nw = catalogResolver.resolveSystem(wsdl);
+            if (nw == null) {
+                nw = catalogResolver.resolveURI(wsdl);
+            }
+            if (nw == null) {
+                nw = catalogResolver.resolvePublic(wsdl, null);
+            }
+            if (nw == null) {
+                nw = wsdl;
+            }
+            return XMLUtils.parse(new InputSource(URIParserUtil.getAbsoluteURI(nw)));
         } catch (FileNotFoundException fe) {
             LOG.log(Level.WARNING, "Can not find the wsdl " + wsdl + "to validate");
             return null;



Mime
View raw message