Skip to content

Use LinkedHashMap for deterministic WSDL namespace prefix assignment#2944

Merged
gnodet merged 2 commits intoapache:mainfrom
gnodet:fix/deterministic-wsdl-namespace-prefixes
Mar 11, 2026
Merged

Use LinkedHashMap for deterministic WSDL namespace prefix assignment#2944
gnodet merged 2 commits intoapache:mainfrom
gnodet:fix/deterministic-wsdl-namespace-prefixes

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 11, 2026

Summary

  • ServiceWSDLBuilder uses a HashMap for ns2prefix, causing 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 prefix assignment deterministic

Related: #1517 (flaky NettyServerTest.testGetWsdl caused by this non-determinism)

Test plan

  • rt/wsdl module tests pass
  • Verify WSDL output is now consistent across runs

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
Copy link
Member

@reta reta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gnodet !

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet merged commit fa4bdfb into apache:main Mar 11, 2026
4 of 6 checks passed
reta pushed a commit that referenced this pull request Mar 11, 2026
…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 <noreply@anthropic.com>
(cherry picked from commit fa4bdfb)
reta pushed a commit that referenced this pull request Mar 11, 2026
…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 <noreply@anthropic.com>
(cherry picked from commit fa4bdfb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants