Fix MavenStaxReader location reporting for properties by gnodet · Pull Request #11402 · apache/maven (original) (raw)
gnodet changed the title
Fix MavenStaxReader location reporting to point to start of XML tags Fix MavenStaxReader location reporting for properties
The location for properties (Map elements) was being captured AFTER calling nextText(), which moves the parser position past the element. This resulted in incorrect location information.
This commit fixes the timing of location capture for properties by saving the line and column numbers BEFORE calling nextText().
Changes:
- Modified src/mdo/reader-stax.vm to capture location before nextText() for properties
- Added comprehensive unit tests for location reporting:
- testLocationReportingForElements() - tests regular elements with exact line/column numbers
- testLocationReportingForAttributes() - tests XML attributes (root, child.scm.connection.inherit.append.path) Note: Attributes get the location of their containing element since XMLStreamReader doesn't provide individual attribute positions
- testLocationReportingForListElements() - tests list elements (modules) with exact line/column numbers
All tests pass successfully.
gnodet added a commit to gnodet/maven that referenced this pull request
The location for properties (Map elements) was being captured AFTER calling nextText(), which moves the parser position past the element. This resulted in incorrect location information.
This commit fixes the timing of location capture for properties by saving the line and column numbers BEFORE calling nextText().
Changes:
- Modified src/mdo/reader-stax.vm to capture location before nextText() for properties
- Added comprehensive unit tests for location reporting:
- testLocationReportingForElements() - tests regular elements with exact line/column numbers
- testLocationReportingForAttributes() - tests XML attributes (root, child.scm.connection.inherit.append.path) Note: Attributes get the location of their containing element since XMLStreamReader doesn't provide individual attribute positions
- testLocationReportingForListElements() - tests list elements (modules) with exact line/column numbers
(cherry picked from commit 6f5c837)
Conflicts:
src/mdo/reader-stax.vm
gnodet added a commit that referenced this pull request
The location for properties (Map elements) was being captured AFTER calling nextText(), which moves the parser position past the element. This resulted in incorrect location information.
This commit fixes the timing of location capture for properties by saving the line and column numbers BEFORE calling nextText().
Changes:
- Modified src/mdo/reader-stax.vm to capture location before nextText() for properties
- Added comprehensive unit tests for location reporting:
- testLocationReportingForElements() - tests regular elements with exact line/column numbers
- testLocationReportingForAttributes() - tests XML attributes (root, child.scm.connection.inherit.append.path) Note: Attributes get the location of their containing element since XMLStreamReader doesn't provide individual attribute positions
- testLocationReportingForListElements() - tests list elements (modules) with exact line/column numbers
(cherry picked from commit 6f5c837)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})