elharo opened a new pull request, #395: URL: https://github.com/apache/maven-shared-utils/pull/395
`Xpp3Dom.removeChild(int)` (line 262) calls `childMap.values().remove(child)` to remove the child from the internal name-to-child map. This is incorrect when multiple children share the same name: - `childMap` stores only the *last* child added with a given name (entries are overwritten by `addChild`) - `values().remove(child)` removes the first matching value — which is the *only* value for that name in the map - When removing a child that was overwritten in the map (i.e., a later child with the same name was added), the map entry is left pointing to the wrong child - When removing the last child with that name, `getChild(name)` correctly returns null but only by coincidence — the map entry was simply removed **Fix:** After removing the child from `childList`, check if `childMap` points to that specific child (by reference). If so, scan `childList` for the last remaining child with the same name and update the map, or remove the entry if none remain. Fixes https://github.com/apache/maven-shared-utils/issues/394 -- 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]
