United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6728842 : File.setReadOnly does not make a directory read-only (win)

Details
Type:
Bug
Submit Date:
2008-07-23
Status:
Closed
Updated Date:
2011-05-26
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-libs
OS:
generic
Sub-Component:
java.io
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
File's setReadOnly method [Also setWritable(false)] does not make a directory read-only on Windows. Instead, it sets the DOS readonly attribute that prevents the directory from being deleted.

This method should be investigated to see if the following are feasible:

1. Have these methods return false for directories (meaning they cannot make the directory readonly)

2. Have the method insert a deny entry at the top of the DACL to deny write access.

                                    

Comments
EVALUATION

The simplest solution is for setReadOnly to return false when the file is a directory.
                                     
2010-09-26



Hardware and Software, Engineered to Work Together