Bug 565016 - XmlStorageElement clear does not remove all attributes
Summary: XmlStorageElement clear does not remove all attributes
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: Next   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-07 08:35 EDT by Ruediger Hillenbarnd CLA
Modified: 2020-07-12 16:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ruediger Hillenbarnd CLA 2020-07-07 08:35:38 EDT
Calling clear() on org.eclipse.cdt.internal.core.settings.model.xml.XmlStorageElement does not remove all attributes from an element. 

Example: 
Calling clear on an element having 3 attributes(a, b, c)will only remove 2 attributes (a, c). The b attribute will not be cleared

The issue seems to be caused by following code in the clear() method and the way attributes are removed from the NamedNodeMap. 

NamedNodeMap map = fElement.getAttributes();
for(int i = 0; i < map.getLength(); i++){
	Node attr = map.item(i);
	if(isPropertyAlowed(attr.getNodeName()))
		map.removeNamedItem(attr.getNodeName());
}
Comment 1 Ruediger Hillenbarnd CLA 2020-07-07 09:53:45 EDT
The situation occurs when writing properties via ICStorageElement.
Comment 2 Jonah Graham CLA 2020-07-12 16:08:03 EDT
Thank you Ruediger for the bug report and analysis. Can you provide a gerrit with a fix that resolves your issue?