JDK-6790382 : (Prefs)Preferences - could not open/create/put/ger/remove under Vista
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 6u10,6u12
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp,windows_vista
  • CPU: x86
  • Submitted: 2009-01-06
  • Updated: 2011-02-16
  • Resolved: 2010-11-30
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Vista Business

EXTRA RELEVANT SYSTEM CONFIGURATION :
Standard configuration

A DESCRIPTION OF THE PROBLEM :
After java runtime update from 1.6.0_7 to 1.6.0_10 or 1.6.0 _11 version. Class java.util.Preferences don't work like before.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start java update. After java update there were bug.


ERROR MESSAGES/STACK TRACES THAT OCCUR :
5.12.2008 9:07:59 java.util.prefs.WindowsPreferences openKey
WARNING: Could not open windows registry node Software\JavaSoft\Prefs\sk\ventus\test at root 0x80000002. Windows RegOpenKey(...) returned error code 2.
java.util.prefs.BackingStoreException: Could not open windowsregistry node Software\JavaSoft\Prefs\sk\ventus\test at root 0x80000002.
        at java.util.prefs.WindowsPreferences.childrenNamesSpi(Unknown Source)
        at java.util.prefs.AbstractPreferences.removeNode2(Unknown Source)
        at java.util.prefs.AbstractPreferences.removeNode(Unknown Source)
        at sk.ventus.test.TestPreferences.main(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package sk.ventus.test;

import java.util.prefs.Preferences;

public class TestPreferences {

	public static void main(String[] args) {
		Preferences preferences = null;
		try {
			System.out.println("Preferences for node:"
					+ TestPreferences.class.getCanonicalName());
			preferences = Preferences
					.systemNodeForPackage(sk.ventus.test.TestPreferences.class);
		} catch (Exception e) {
			e.printStackTrace();
			return;
		}
		if (preferences != null) {
			try {
				System.out.println("Put int :"
						+ TestPreferences.class.getCanonicalName() + " " + 13);
				preferences.putInt("PREF_NAME", 13);
			} catch (Exception e) {
				e.printStackTrace();
			}
			try {
				System.out.println("Get int :"
						+ TestPreferences.class.getCanonicalName() + " " + 13);
				preferences.getInt("PREF_NAME", 13);
			} catch (Exception e) {
				e.printStackTrace();
			}
			try {
				System.out.println("Remove node");
				preferences.removeNode();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return;
		}

	}
}
---------- END SOURCE ----------

Release Regression From : 6u7
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION Copy/pasted #6809488 evaluation here. "There is a change in behavior between 6u7 and 6u10. Releases prior to 6u10 didn't specify the requestedExecutionLevel in the manifest of "java.exe" and so Windows Vista treated it as a legacy application. Legacy applications have access to the registry virtualized. In particular, write access to the registry is redirected to a per-user location ( HKEY_CURRENT_USER\Software\Classes\VirtualStore\SOFTWARE\JavaSoft\Prefs instead of KHEY_LOCAL_MACHINE\Software\JavaSoft\Prefs). 6u10 has the manifest in java.exe and so correctly fails with 6u10 and newer updates." Closed with "will not fix".
30-11-2010

EVALUATION See evaluation in 6809488.
02-03-2009