RFR 8139507: WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs

Jan Lahoda jan.lahoda at oracle.com
Wed Jun 8 17:39:31 UTC 2016


Hello,

When starting JShell on Windows, one may see a message like this:

?vn 08, 2016 6:46:35 ODP. java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs 
at root 0 x80000002. Windows RegCreateKeyEx(...) returned error code 5.

The problem, as far as I can understand, is that when the JShell tool 
asks for the user Preferences (Preferences.userRoot()), not only the 
user preferences get created, but also the system preferences get 
created. And when the given (system) root node cannot be created (e.g. 
due to permissions), the above warning is printed.

As JShell does not need system Preferences, I don't think this warning 
does not make much sense in the JShell context. My proposal is to create 
both the user and system Preferences lazily on Windows, so applications 
that only need user Preferences don't trigger the warning. As far as I 
can tell, this is consistent with what the FileSystemPreferences do:
http://hg.openjdk.java.net/jdk9/dev/jdk/file/7f5b7acebffd/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java#l160

Bugs:
https://bugs.openjdk.java.net/browse/JDK-8139507
https://bugs.openjdk.java.net/browse/JDK-8158292

Webrev:
http://cr.openjdk.java.net/~jlahoda/8139507/webrev.00/

Not sure if there's a way to write a test for the behavior, I didn't see 
an obvious way. Any suggestions on testing would be welcome!

Any feedback is welcome!

Thanks,
     Jan


More information about the core-libs-dev mailing list