This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch 4.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 57ea4a5441939414c569ede24e6f43c2239a4dc7 Author: Colm O hEigeartaigh <[email protected]> AuthorDate: Thu Apr 23 16:17:13 2026 +0100 Fixup for tests after wsmex patch (cherry picked from commit 684245cb2fe1a0d89276a70f1874f97af7232ab6) --- .../java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java | 6 ++---- .../org/apache/cxf/ws/security/trust/AbstractSTSClientTest.java | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java index 8d1b68adc6a..fd7a0eac05c 100755 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java @@ -551,7 +551,7 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv definition = bus.getExtension(WSDLManager.class).getDefinition((Element)s.getAny()); } else if ("http://www.w3.org/2001/XMLSchema".equals(s.getDialect())) { - Element schemaElement = getSchemaElement(s); + Element schemaElement = getSchemaElement((Element)s.getAny(), s.getLocation()); if (schemaElement != null) { QName schemaName = new QName(schemaElement.getNamespaceURI(), schemaElement.getLocalName()); @@ -620,14 +620,12 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv } } - protected Element getSchemaElement(MetadataSection s) throws Exception { - Element schemaElement = (Element)s.getAny(); + protected Element getSchemaElement(Element schemaElement, String schemaLocation) throws Exception { if (schemaElement == null) { if (!allowMexMetadataSchemaLocation) { LOG.info("Loading a schema from WS-MEX MetadataSection Location is disabled by " + " default. Enable allowMexMetadataSchemaLocation to allow it."); } else { - String schemaLocation = s.getLocation(); LOG.info("XSD schema location: " + schemaLocation); schemaElement = downloadSchema(schemaLocation); } diff --git a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/trust/AbstractSTSClientTest.java b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/trust/AbstractSTSClientTest.java index 48f43402dfb..e91232220d3 100644 --- a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/trust/AbstractSTSClientTest.java +++ b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/trust/AbstractSTSClientTest.java @@ -44,7 +44,7 @@ public class AbstractSTSClientTest { section.setLocation("http://example.org/schema.xsd"); assertFalse(client.isAllowMexMetadataSchemaLocation()); - assertTrue(client.getSchemaElement(section) == null); + assertTrue(client.getSchemaElement((Element)section.getAny(), section.getLocation()) == null); } @Test @@ -56,7 +56,7 @@ public class AbstractSTSClientTest { client.setAllowMexMetadataSchemaLocation(true); - Element schemaElement = client.getSchemaElement(section); + Element schemaElement = client.getSchemaElement((Element)section.getAny(), section.getLocation()); assertEquals(1, client.getDownloadSchemaInvocations()); assertEquals("http://example.org/schema.xsd", client.getLastDownloadedLocation()); assertEquals(XMLConstants.W3C_XML_SCHEMA_NS_URI, schemaElement.getNamespaceURI()); @@ -73,7 +73,7 @@ public class AbstractSTSClientTest { Element inlineSchema = document.createElementNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "xsd:schema"); section.setAny(inlineSchema); - Element schemaElement = client.getSchemaElement(section); + Element schemaElement = client.getSchemaElement((Element)section.getAny(), section.getLocation()); assertSame(inlineSchema, schemaElement); assertEquals(0, client.getDownloadSchemaInvocations()); }
