Author: eglynn
Date: Fri Jan 8 14:40:19 2010
New Revision: 897217
URL: http://svn.apache.org/viewvc?rev=897217&view=rev
Log:
Fix for [CXF-2609] Schema validation failure when null system ID passed to
LSResourceResolver.resolveResource()
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=897217&r1=897216&r2=897217&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Fri Jan 8 14:40:19 2010
@@ -21,6 +21,7 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URI;
@@ -155,6 +156,23 @@
done.add(newId + ":" + namespaceURI);
return impl;
}
+
+ // handle case where given systemId is null (so that
+ // direct key lookup fails) by scanning through map
+ // searching for a namespace match
+ //
+ for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
+ if (ent.getKey().endsWith(namespaceURI)) {
+ schemas.remove(ent.getKey());
+ LSInputImpl impl = new LSInputImpl();
+ impl.setSystemId(newId);
+ impl.setBaseURI(newId);
+ impl.setCharacterStream(
+ new InputStreamReader(
+ new ByteArrayInputStream(ent.getValue())));
+ return impl;
+ }
+ }
//REVIST - we need to get catalogs in here somehow :-(
if (systemId == null) {