Project: Eclipse_Platform_UI
Bug 104047 [Dialogs] Incorrect Output from DialogSettings.save()
Reported: 2005-07-15 13:17:26 | Status: verified fixed

The XML produced by the DialogSettings.save() method is not correct. If multiple arrayItems exist, every element after the first will have an extra "value" attribute. Here is a code snipet to illustrate: IDialogSettings export = new DialogSettings("Example"); String[] values1 = { "value1", "value2" }; export.put("key1", values1 ); String[] values2 = { "value3", "value4" }; export.put("key2", values2 ); try { export.save("C:\\test.xml"); } catch (IOException e) { // Do Nothing } The output of this is: <?xml version="1.0" encoding="UTF-8"?> <section name="Example"> <list key="key1"> <item value="value1"/> <item value="value2"/> </list> <list key="key2" value="value2"> <item value="value3"/> <item value="value4"/> </list> </section> As you can see, the second "list" has an attribute "value" which it shouldn't. The reason is the value from the previous list element is not cleared before writing the second element. I.E. "value2" from the first list element is used as the value attribute for the second list element. Suggested fix: In DialogSettings.save(), add another "attributes.clear();" for the loop that iterates over the aarryItems field.

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java