JDK-6791797 : Creating a file under "Program Files" fails when should gone file virtualization
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 6u10
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2009-01-08
  • Updated: 2010-04-04
  • Resolved: 2009-01-09
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
1.6.0_10
1.6.0_11
1.6.0_12_ea

ADDITIONAL OS VERSION INFORMATION :
Windows Vista Enterprise

A DESCRIPTION OF THE PROBLEM :
On windows Vista, with UAC on, "C:\Program Files" is protected. When writing to this directory, vista's file virtualization kicks in, the write does not fail, just that it's written to the VirtualStore under the user's directory. This is the behavior prior to 1.6.0_07. After 1.6.0_10, the same program would produce a "java.io.IOException: Access is denied" exception. This is a regression and a behavior change.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.io.File;
import java.io.IOException;

public class WindowsUAC {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		File f = new File("C:\\Program Files\\foo.txt");
		f.createNewFile();
	}

}
---------- 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 The executable (.exe) files in releases prior to 6u10 did not have a manifest to define the execution level and so were treated as legacy executables by Windows Vista. As a result, they were subjected to Vista's file system and registry virtualization. As part of the OEM certification manifests are now compiled into into executables (see 6722527) and so applications using java.io to access files in %ProgramFiles%, %ProgramData%, and %SystemRoot% now behave as expected.
09-01-2009