Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes Preferences.systemRoot() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Preferences.systemRoot()" Watch "Preferences.systemRoot()" New topic
Author

Preferences.systemRoot()

Adam Teg
Ranch Hand

Joined: Jul 10, 2007
Posts: 58
Assume a user has access to windows registry HKEY_LOCAL_MACHINE. Is there a possibility that Preferences.systemRoot() for a particular key not be accessiable based on System.getSecurityManager()? Is there an intermitant access issue i.e. sometimes the user has access other times not.

Thanks
Adam Teg
Ranch Hand

Joined: Jul 10, 2007
Posts: 58
Anyone anyone!!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

There's no generic answer to this, because it is possible that every method declared to throw a SecurityException can throw one at any time, for any reason, because access is controlled by a policy which can be customized for each user. Furthermore, details such as where the Preferences API stores its data is completely implementation-dependent, and can (and will) vary across VM versions and implementations. Finally, note that the specific details you're asking about are relevant only on Windows; in general, you need to write Java code so that it works on any platform.

So you should code as if the answer were yes, the Preferences methods declared to throw SecurityException can do so any time you call them.


[Jess in Action][AskingGoodQuestions]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Preferences.systemRoot()
 
Similar Threads
How to programmatically authorize a User based upon User Group
Servlets 4b - Dark Secrets
Cache Reference Information
updating server.xml from servlet
Ldap logging