Make Java ignore section headers in Preferences file and start file with [Preferences] to match C++ (fixes artf3629)

Change-Id: Ia56cca061851727eee25d3996314a01022378a07
This commit is contained in:
Kevin O'Connor
2014-10-15 14:37:25 -04:00
parent 08c8723174
commit dad3b68f36

View File

@@ -503,6 +503,8 @@ public class Preferences {
file.createNewFile();
output = new FileOutputStream(file);
output.write("[Preferences]\n".getBytes());
for (int i = 0; i < keys.size(); i++) {
String key = (String) keys.elementAt(i);
@@ -616,7 +618,11 @@ public class Preferences {
buffer.append('\n');
comment.addBytes(buffer.toString().getBytes());
}
} else {
} else if (value == '[') {
// Find the end of the section and the new line after it and throw it away
while (reader.read() !=']');
while (reader.read() != '\n');
} else {
buffer = new StringBuffer(30);
for (; value != '='; value = reader.readWithoutWhitespace()) {
buffer.append(value);