Fix DefaultSettingsXmlFactory.write() always emitting location comments#11924
Fix DefaultSettingsXmlFactory.write() always emitting location comments#11924utafrali wants to merge 1 commit into
Conversation
Mirror the pattern from DefaultModelXmlFactory.write() to disable location information by default and only enable it when an InputLocationFormatter is provided via the request. Closes apache#11899
|
@utafrali Hi! Thanks a lot for opening this pull request. I really appreciate the effort. Before moving forward, could you add unit tests to cover the changes? That helps ensure the update behaves as expected. |
gnodet
left a comment
There was a problem hiding this comment.
Claude Code on behalf of Guillaume Nodet
This PR is now superseded by #11984, which was merged on May 20, 2026 (commit 3e38c39). That PR contains the identical fix for DefaultSettingsXmlFactory.write(), and additionally:
- Fixes the same issue in
DefaultToolchainsXmlFactory.write()(which this PR does not address) - Includes comprehensive unit tests for both factories (
DefaultSettingsXmlFactoryTestandDefaultToolchainsXmlFactoryTest)
The production code change in this PR is correct and follows the established pattern from DefaultModelXmlFactory.write(), but since #11984 has already landed on master with a broader scope, this PR can be closed.
Thank you @utafrali for identifying the bug and opening this PR -- you were first to submit a fix (April 10 vs April 24 for #11984). The analysis in issue #11899 was thorough and helpful.
Aligns
DefaultSettingsXmlFactory.write()with the existing pattern inDefaultModelXmlFactory.write(). The writer now defaults toaddLocationInformation = falseand only enables it when anInputLocationFormatteris provided in the request.Previously the
SettingsStaxWriterconstructor defaultedaddLocationInformationtotrue, so every serialized settings document included location tracking comments regardless of whether a formatter was configured.Closes #11899