Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2172669 | 1.4-pool | Unassigned | P4 | Closed | Won't Fix |
Because we had to back out the changes for 6350200, the bug still exists. We need to create a new bug which replicates the appropriate information so that it may be addressed in a later release.
These are the relevant portions of the description of 6350200.
When opening a hidden file for write access the FileNotFoundException exception is thrown. If you remove the hidden attribute (via attrib) the exception is not thrown and application works correctly.
import java.io.*;
public class HiddenFileTest {
// Main function, launches JFileChooser to select a directory
public static void main( String[] args ) {
try {
FileWriter fw = new FileWriter( "C:\\temp\\file1.txt" );
PrintWriter out = new PrintWriter( fw );
out.println( "This is a test 2" );
out.close();
} catch( IOException e ) {
e.printStackTrace( System.out );
}
}
}
Steps to reproduce:
- Run the provided test. It will create a c:\temp\file1.txt file.
- Hide the file.
> attrib +h c:\temp\file1.txt
- Run the test again.
> java -cp . HiddenFileTest
java.io.FileNotFoundException: C:\temp\file1.txt (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileWriter.<init>(Unknown Source)
at HiddenFileTest.main(HiddenFileTest.java:7)
- Grant access to the file.
> attrib -h c:\temp\file1.txt
- Test will run successfully.
These are the relevant portions of the description of 6350200.
When opening a hidden file for write access the FileNotFoundException exception is thrown. If you remove the hidden attribute (via attrib) the exception is not thrown and application works correctly.
import java.io.*;
public class HiddenFileTest {
// Main function, launches JFileChooser to select a directory
public static void main( String[] args ) {
try {
FileWriter fw = new FileWriter( "C:\\temp\\file1.txt" );
PrintWriter out = new PrintWriter( fw );
out.println( "This is a test 2" );
out.close();
} catch( IOException e ) {
e.printStackTrace( System.out );
}
}
}
Steps to reproduce:
- Run the provided test. It will create a c:\temp\file1.txt file.
- Hide the file.
> attrib +h c:\temp\file1.txt
- Run the test again.
> java -cp . HiddenFileTest
java.io.FileNotFoundException: C:\temp\file1.txt (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileWriter.<init>(Unknown Source)
at HiddenFileTest.main(HiddenFileTest.java:7)
- Grant access to the file.
> attrib -h c:\temp\file1.txt
- Test will run successfully.
- backported by
-
JDK-2172669 FileOutputStream.open() throws FileNotFoundException for hidden file (win)
-
- Closed
-
- relates to
-
JDK-6350200 FileOutputStream.open() throws FileNotFoundException for hidden file (win)
-
- Resolved
-
-
JDK-6364894 FileOutputStream is able to modify/write to read-only filessince Mustang-b63 (win)
-
- Closed
-