Skip to content

Commit e0985a6

Browse files
committed
Plug URIResolver into EndpointReferenceUtils
1 parent 6af78b8 commit e0985a6

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

core/src/main/java/org/apache/cxf/ws/addressing/EndpointReferenceUtils.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
package org.apache.cxf.ws.addressing;
2121

2222
import java.io.ByteArrayInputStream;
23-
import java.io.InputStream;
2423
import java.lang.ref.Reference;
2524
import java.lang.ref.SoftReference;
2625
import java.net.MalformedURLException;
@@ -72,6 +71,7 @@
7271
import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
7372
import org.apache.cxf.resource.ExtendedURIResolver;
7473
import org.apache.cxf.resource.ResourceManager;
74+
import org.apache.cxf.resource.URIResolver;
7575
import org.apache.cxf.service.model.SchemaInfo;
7676
import org.apache.cxf.service.model.ServiceInfo;
7777
import org.apache.cxf.staxutils.StaxUtils;
@@ -550,20 +550,17 @@ private static Schema createSchema(ServiceInfo serviceInfo, Bus b) {
550550
&& !schemaSourcesMap.containsKey(sch.getSourceURI() + ':'
551551
+ sch.getTargetNamespace())) {
552552

553-
InputStream ins = null;
554-
try {
555-
URL url = new URL(sch.getSourceURI());
556-
ins = url.openStream();
553+
LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
554+
try (URIResolver resolver = new URIResolver(sch.getSourceURI())) {
555+
if (resolver.getInputStream() == null) {
556+
sch.write(out);
557+
} else {
558+
IOUtils.copyAndCloseInput(resolver.getInputStream(), out);
559+
}
557560
} catch (Exception e) {
558561
//ignore, we'll just use what we have. (though
559562
//bugs in XmlSchema could make this less useful)
560-
}
561-
562-
LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
563-
if (ins == null) {
564563
sch.write(out);
565-
} else {
566-
IOUtils.copyAndCloseInput(ins, out);
567564
}
568565

569566
schemaSourcesMap.put(sch.getSourceURI() + ':'

0 commit comments

Comments
 (0)