I have the following method in a class I use to modify system preferences:
This code appears to work fine (the return value is always true when I provide a valid node path), but when I run it and then look at the preferences under $JAVA_HOME/jre/.systemPrefs I still see the node in the prefs.xml. This is happening regardless of whether the program that uses the prefs is running or not. I get the same behavior on a Windows machine when I view the preferences using regedit.
Can someone please tell me what I'm missing here? Thanks in advance for your help.
For one thing have you checked if you're getting a BackingStoreException? Depending on permissions it may not be possible to remove a node.
posted 12 years ago
Thanks for your suggestion. However I think that if a BackingStoreException occurs as a result of the flush() in this method then it will be thrown, and the method should never reach completion (returning a boolean true). In all of my tests and debugging sessions the exception is never thrown, and the method completes normally. You can get SecurityExceptions due to insufficient permissions from several other methods of the Preferences class, but there's nothing mentioned about this for flush().
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database