File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Preferences.systemRoot()" Watch "Preferences.systemRoot()" New topic


Adam Teg
Ranch Hand

Joined: Jul 10, 2007
Posts: 59
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.

Adam Teg
Ranch Hand

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

Joined: Jul 08, 2003
Posts: 24199

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]
I agree. Here's the link:
subject: Preferences.systemRoot()
It's not a secret anymore!