| Summary: | NodeContainer.replaceChild removes a child that is replaced by itself | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | Tobias Liefke <eclipse> | ||||
| Component: | wst.xml | Assignee: | Tobias Liefke <eclipse> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Nitin Dahyabhai <thatnitind> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | nsand.dev | ||||
| Version: | 3.3 | ||||||
| Target Milestone: | 3.3.1 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Thanks for your patch, Tobias. Looks great! I've added a unit test to go along with the fix and released the code. |
Created attachment 200591 [details] Proposed patch for the NodeContainer When calling org.w3c.dom.Node node, child; node.replaceChild(child, child); I would expect that the result is the same DOM as before. But as the JavaDoc for org.w3c.dom.Node.replaceChild(Node, Node) says: "Replacing a node with itself is implementation dependent." I would at least expect an exception then. The org.eclipse.wst.xml.core.internal.document.NodeContainer.replaceChild(Node, Node) implementation does something totally different: it removes the given node. From my point of view, it should make an identity check before any modification.