• 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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
 
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
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!