You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2026/03/11 21:28:58 UTC
(cxf) 05/08: Use LinkedHashMap for deterministic WSDL namespace prefix assignment (#2944)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 401707c39fc422531638106ff74e309ae2290385
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Mar 11 17:30:52 2026 +0100
Use LinkedHashMap for deterministic WSDL namespace prefix assignment (#2944)
ServiceWSDLBuilder uses a HashMap for the ns2prefix map, which causes
non-deterministic namespace prefix assignment in generated WSDL. This
leads to inconsistent output where elements may appear with or without
namespace prefixes (e.g., <service> vs <wsdl:service>) depending on
HashMap iteration order.
Switch to LinkedHashMap to ensure insertion-order iteration, making
the prefix assignment in getNewPrefix() deterministic.
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
(cherry picked from commit fa4bdfbabdc2d786390c498b89d28a55114f908f)
---
rt/wsdl/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
index 0f40280d30..a5a209d846 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -111,7 +112,7 @@ public class ServiceWSDLBuilder {
public ServiceWSDLBuilder(Bus b, List<ServiceInfo> services) {
this.services = services;
bus = b;
- ns2prefix = new HashMap<>();
+ ns2prefix = new LinkedHashMap<>();
nsMan = new NSManager();
}