Skip to content

Commit 01b7df7

Browse files
committed
Support user preferences exported by the Export->Preferences wizard by
removing prefixes when loading.
1 parent fd7ec8b commit 01b7df7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

findbugs/src/java/edu/umd/cs/findbugs/config/UserPreferences.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,19 @@ public void read(@WillClose InputStream in) throws IOException {
198198
if (props.size() == 0) {
199199
return;
200200
}
201+
202+
Properties prefixlessProperties = new Properties();
203+
for (Map.Entry<?, ?> e : props.entrySet()) {
204+
if(e.getKey() instanceof String) {
205+
String key = e.getKey().toString();
206+
String value = e.getValue().toString();
207+
prefixlessProperties.setProperty(key.replace("/instance/edu.umd.cs.findbugs.plugin.eclipse/", ""), value);
208+
} else {
209+
prefixlessProperties.put(e.getKey(), e.getValue());
210+
}
211+
}
212+
props = prefixlessProperties;
213+
201214
for (int i = 0; i < MAX_RECENT_FILES; i++) {
202215
String key = "recent" + i;
203216
String projectName = (String) props.get(key);
@@ -206,6 +219,7 @@ public void read(@WillClose InputStream in) throws IOException {
206219
}
207220
}
208221

222+
209223
for (Map.Entry<?, ?> e : props.entrySet()) {
210224

211225
String key = (String) e.getKey();

0 commit comments

Comments
 (0)