Author: dandiep
Date: Mon May 8 07:10:53 2006
New Revision: 405060
URL: http://svn.apache.org/viewcvs?rev=405060&view=rev
Log:
Improve resolution for the File case - especially when a trailing slash is
missing
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=405060&r1=405059&r2=405060&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
Mon May 8 07:10:53 2006
@@ -46,9 +46,13 @@
String schemaLocation,
String baseUri){
- if (baseUri!=null) {
+ if (baseUri!=null)
+ {
try
{
+ File baseFile = new File(baseUri);
+ if (baseFile.exists()) baseUri = baseFile.toURI().toString();
+
String ref = new URI(baseUri).resolve(new
URI(schemaLocation)).toString();
return new InputSource(ref);
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=405060&r1=405059&r2=405060&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java
(original)
+++ webservices/commons/trunk/modules/XmlSchema/test/tests/ImportTest.java Mon
May 8 07:10:53 2006
@@ -33,10 +33,15 @@
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);
+ // attempt with slash now
+ schemaCol = new XmlSchemaCollection();
+ schemaCol.setBaseUri("test-resources/");
+ schema = schemaCol.read(doc,null);
+ assertNotNull(schema);
}
/**