SABITHSAHEB opened a new pull request, #292:
URL: https://github.com/apache/commons-jxpath/pull/292

   - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
   - [x] Read the [ASF Generative Tooling 
Guidance](https://www.apache.org/legal/generative-tooling.html) if you use 
Artificial Intelligence (AI).
   - [x] I used AI to create any part of, or all of, this pull request. Which 
AI tool was used to create this pull request, and to what extent did it 
contribute? Claude Code helped analyze the code and draft the change; it was 
reviewed and the build and tests were run before submission.
   - [x] Run a successful build using the default 
[Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command 
line by itself.
   - [x] Write unit tests that match behavioral changes, where the tests fail 
if the changes to the runtime are not applied. This may not always be possible, 
but it is a best practice.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line 
and body. Note that a maintainer may squash commits during the merge process.
   
   1. `NodePointer.escape` writes `'` and `"` as `'`/`"` but leaves 
`&` alone, so a dynamic property name containing the literal text `'` 
yields the same `asPath()` as a name containing a real quote: a map with the 
keys `Key'1` and `Key'1` prints `/map[@name='Key'1']` for both 
entries.
   2. Re-evaluating such a stored path with `getValue`, `setValue` or 
`removePath` then resolves to the wrong entry, so a name chosen to contain an 
entity sequence silently aliases a sibling entry's pointer path.
   3. `escape` now also emits `&` for an ampersand that starts an `'`, 
`"` or `&` sequence, and the parser's `unescape` (`XPath.jj` and the 
checked-in `XPathParser.java`) decodes `&` in a single left-to-right pass, 
so escaped output decodes to exactly the original name.
   
   A lone `&` still needs no escaping and `&` only decodes where it appears 
literally, so existing stored paths and hand-written literals like `'Tom & 
Jerry'` parse as before; the only changed input is a literal containing the 
exact sequence `&`, which previously could not be produced by `asPath()` at 
all. The new test in `DynamicPropertiesModelTest` fails before the change and 
passes after.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to