elharo opened a new issue, #394:
URL: https://github.com/apache/maven-shared-utils/issues/394

   `Xpp3Dom.removeChild(int)` (line 262-266) removes a child by index from 
`childList`, but then calls `childMap.values().remove(child)` to remove it from 
the map. This has two problems:
   
   1. `childMap.values().remove(child)` removes the *first* matching value by 
object identity, which may be a different child than the one removed from 
`childList` when multiple children share the same name.
   2. The map entry key (child name) is never removed, so `getChild(name)` may 
still return a stale or incorrect child.
   
   Fix: use `childMap.remove(child.getName(), child)` which atomically removes 
the entry only when both the key and value match (available since Java 8).


-- 
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