|
20 | 20 | package org.apache.cxf.ws.addressing; |
21 | 21 |
|
22 | 22 | import java.io.ByteArrayInputStream; |
23 | | -import java.io.InputStream; |
24 | 23 | import java.lang.ref.Reference; |
25 | 24 | import java.lang.ref.SoftReference; |
26 | 25 | import java.net.MalformedURLException; |
|
72 | 71 | import org.apache.cxf.helpers.LoadingByteArrayOutputStream; |
73 | 72 | import org.apache.cxf.resource.ExtendedURIResolver; |
74 | 73 | import org.apache.cxf.resource.ResourceManager; |
| 74 | +import org.apache.cxf.resource.URIResolver; |
75 | 75 | import org.apache.cxf.service.model.SchemaInfo; |
76 | 76 | import org.apache.cxf.service.model.ServiceInfo; |
77 | 77 | import org.apache.cxf.staxutils.StaxUtils; |
@@ -550,20 +550,17 @@ private static Schema createSchema(ServiceInfo serviceInfo, Bus b) { |
550 | 550 | && !schemaSourcesMap.containsKey(sch.getSourceURI() + ':' |
551 | 551 | + sch.getTargetNamespace())) { |
552 | 552 |
|
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 | + } |
557 | 560 | } catch (Exception e) { |
558 | 561 | //ignore, we'll just use what we have. (though |
559 | 562 | //bugs in XmlSchema could make this less useful) |
560 | | - } |
561 | | - |
562 | | - LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream(); |
563 | | - if (ins == null) { |
564 | 563 | sch.write(out); |
565 | | - } else { |
566 | | - IOUtils.copyAndCloseInput(ins, out); |
567 | 564 | } |
568 | 565 |
|
569 | 566 | schemaSourcesMap.put(sch.getSourceURI() + ':' |
|
0 commit comments