Author: dandiep
Date: Sat May  6 14:57:50 2006
New Revision: 400374

URL: http://svn.apache.org/viewcvs?rev=400374&view=rev
Log:
Use Java's built in URI resolution

Modified:
    
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
    webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java

Modified: 
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java?rev=400374&r1=400373&r2=400374&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
 (original)
+++ 
webservices/commons/trunk/modules/XmlSchema/src/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
 Sat May  6 14:57:50 2006
@@ -5,6 +5,8 @@
 
 import java.io.IOException;
 import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.MalformedURLException;
 /*
@@ -44,17 +46,18 @@
                                      String schemaLocation,
                                      String baseUri){
 
-        if (baseUri!=null){
-            if (!isAbsolute(schemaLocation)){
-                try {
-                    schemaLocation =
-                            getURL(new URL(baseUri), 
schemaLocation).toString();
-                } catch (Exception e) {
-                    schemaLocation = baseUri +
-                            (schemaLocation.startsWith("/")?"":"/")+
-                            schemaLocation;
-                }
+        if (baseUri!=null) {
+            try
+            {
+                String ref = new URI(baseUri).resolve(new 
URI(schemaLocation)).toString();
+
+                return new InputSource(ref);
+            }
+            catch (URISyntaxException e1)
+            {
+                throw new RuntimeException(e1);
             }
+
         }
         return new InputSource(schemaLocation);
 

Modified: webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java?rev=400374&r1=400373&r2=400374&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java 
(original)
+++ webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java Sat 
May  6 14:57:50 2006
@@ -33,7 +33,7 @@
                 parse("test-resources/importBase.xsd");
 
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-        schemaCol.setBaseUri("test-resources");
+        schemaCol.setBaseUri("test-resources/");
         XmlSchema schema = schemaCol.read(doc,null);
         assertNotNull(schema);
 


Reply via email to