You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2026/07/09 12:38:34 UTC
(cxf) 01/01: Plug URIResolver into EndpointReferenceUtils
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch coheigea/epr-uri
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit e0985a6c77d8fcd6b6215b21a651deea1243a22a
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Jul 9 13:38:05 2026 +0100
Plug URIResolver into EndpointReferenceUtils
---
.../cxf/ws/addressing/EndpointReferenceUtils.java | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/core/src/main/java/org/apache/cxf/ws/addressing/EndpointReferenceUtils.java b/core/src/main/java/org/apache/cxf/ws/addressing/EndpointReferenceUtils.java
index d6bf974f51f..90bb8bc9230 100644
--- a/core/src/main/java/org/apache/cxf/ws/addressing/EndpointReferenceUtils.java
+++ b/core/src/main/java/org/apache/cxf/ws/addressing/EndpointReferenceUtils.java
@@ -20,7 +20,6 @@
package org.apache.cxf.ws.addressing;
import java.io.ByteArrayInputStream;
-import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.net.MalformedURLException;
@@ -72,6 +71,7 @@ import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
import org.apache.cxf.resource.ExtendedURIResolver;
import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.URIResolver;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.staxutils.StaxUtils;
@@ -550,20 +550,17 @@ public final class EndpointReferenceUtils {
&& !schemaSourcesMap.containsKey(sch.getSourceURI() + ':'
+ sch.getTargetNamespace())) {
- InputStream ins = null;
- try {
- URL url = new URL(sch.getSourceURI());
- ins = url.openStream();
+ LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
+ try (URIResolver resolver = new URIResolver(sch.getSourceURI())) {
+ if (resolver.getInputStream() == null) {
+ sch.write(out);
+ } else {
+ IOUtils.copyAndCloseInput(resolver.getInputStream(), out);
+ }
} catch (Exception e) {
//ignore, we'll just use what we have. (though
//bugs in XmlSchema could make this less useful)
- }
-
- LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
- if (ins == null) {
sch.write(out);
- } else {
- IOUtils.copyAndCloseInput(ins, out);
}
schemaSourcesMap.put(sch.getSourceURI() + ':'