• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Preferences.removeNode() doesn't actually remove the preference node  RSS feed

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


--James
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For one thing have you checked if you're getting a BackingStoreException? Depending on permissions it may not be possible to remove a node.
 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().


--James
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!