|
@@ -348,6 +348,7 @@ public class Identity extends ConfigSource implements Serializable,
|
348
|
348
|
public void setOption(final String domain, final String option,
|
349
|
349
|
final String value) {
|
350
|
350
|
String oldValue;
|
|
351
|
+ boolean unset = false;
|
351
|
352
|
|
352
|
353
|
synchronized (this) {
|
353
|
354
|
oldValue = getOption(domain, option);
|
|
@@ -365,23 +366,31 @@ public class Identity extends ConfigSource implements Serializable,
|
365
|
366
|
|
366
|
367
|
if (globalConfig.hasOption(domain, option)
|
367
|
368
|
&& globalConfig.getOption(domain, option).equals(value)) {
|
|
369
|
+ // The new value is covered by a default setting
|
368
|
370
|
if (oldValue == null) {
|
|
371
|
+ // There was no old value, so we don't need to do anything
|
369
|
372
|
return;
|
370
|
373
|
} else {
|
371
|
|
- unsetOption(domain, option);
|
372
|
|
- return;
|
|
374
|
+ // There was an old value, so we need to unset it so
|
|
375
|
+ // that the default shows through.
|
|
376
|
+ file.getKeyDomain(domain).remove(option);
|
|
377
|
+ needSave = true;
|
|
378
|
+ unset = true;
|
373
|
379
|
}
|
374
|
380
|
}
|
375
|
381
|
}
|
376
|
|
- }
|
377
|
382
|
|
378
|
|
- if ((oldValue == null && value != null)
|
379
|
|
- || (oldValue != null && !oldValue.equals(value))) {
|
380
|
|
- synchronized (this) {
|
|
383
|
+ if (!unset && ((oldValue == null && value != null)
|
|
384
|
+ || (oldValue != null && !oldValue.equals(value)))) {
|
381
|
385
|
file.getKeyDomain(domain).put(option, value);
|
382
|
386
|
needSave = true;
|
383
|
387
|
}
|
|
388
|
+ }
|
384
|
389
|
|
|
390
|
+ // Fire any setting change listeners now we're no longer holding
|
|
391
|
+ // a lock on this identity.
|
|
392
|
+ if (unset || (oldValue == null && value != null)
|
|
393
|
+ || (oldValue != null && !oldValue.equals(value))) {
|
385
|
394
|
fireSettingChange(domain, option);
|
386
|
395
|
}
|
387
|
396
|
}
|