Skip to content

Commit 967ac72

Browse files
committed
PrefService: fix bug in remove method
When removing a key, there are actually two different scenarios: 1. In the case of Map or List, the key is actually the name of a child node whose key/value pairs are the elements of the collection. 2. In the case of String or primitive values, the key really is a key in the backing preferences node. In the case of (1), the child node should be removed, whereas in the case of (2), the key should simply be removed. The code was handling the former, but not the latter.
1 parent 5fb1ca5 commit 967ac72

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/org/scijava/prefs/DefaultPrefService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ public SmartPrefs(final java.util.prefs.Preferences p,
307307

308308
public void remove(final String key) {
309309
if (nodeExists(key)) node(key).removeNode();
310+
p.remove(safeKey(key));
310311
}
311312

312313
public void putMap(final Map<String, String> map) {

0 commit comments

Comments
 (0)