4939819: File.canWrite() returns false for the "My Documents" directory (win)

Alan Bateman Alan.Bateman at Sun.COM
Thu Apr 10 13:37:00 UTC 2008

I need a reviewer for 4939819. This is one that the desktop folks have 
been asking to be fixed for some time. On Windows the DOS read-only 
attribute doesn't make a directory read-only. Instead this attribute 
just prevents a directory from being deleted. The bug is that 
java.io.File's canWrite method returns false when this attribute is set 
whereas it should be ignored when checking access to directories. The 
attached patch fixes this by ignoring the attribute on directories. 
There shouldn't be any side effects moving from _waccess to 
GetFileAttributes because the Microsoft CRT has always implemented 
_waccess as a call to GetFileAttributesW.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: canWrite.patch
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20080410/69baf8dc/canWrite.patch>

More information about the core-libs-dev mailing list