JDK-4041126 : java.io.File.delete: NT Permission problem
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1,1.1.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-03-25
  • Updated: 2009-02-16
  • Resolved: 2009-02-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Duplicate :  
Duplicate :  
Name: sgC58550			Date: 03/25/97

Given a NT file with "Full Permissions" set to "Everybody".

the file:
File usagers = new File("d:\\java\\httpserver\\outbox.tmp");

The output is:

and the file is not deleted.

If I set the permissions to "none" for "Everybody" and I run the 
same code, the output is:

and the file is deleted.
company - Oricom Internet , email - ###@###.###

EVALUATION 4/29/06: The implementation of canRead and canWrite date back to JDK1.0. They were implemented using the Win32 access/waccess function which simply checks that the file exists and does a simple check of the readonly attribute. It does not check the ACL and hence does not report the actual/effective access to the file. This is fixable for regular files but more complex for directories. Another aspect to this bug is that File's delete method returns a boolean and there isn't an exception to indicate the reason why it failed. As part of JSR-203 we will be providing a new file system API that will provide access to the security attributes. This will allow applications to determine the effective access to the file. Also, all operations on files will throw exceptions so that security/permission related failures will be clearly reported.

WORK AROUND Name: sgC58550 Date: 03/25/97 ======================================================================