Name: jl125535 Date: 01/16/2003
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
windows 2000 professional 5.00.2195 Service pack 3
A DESCRIPTION OF THE PROBLEM :
The FileInputStream constructor deletes a file that does not have read
permission.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create the file testfile.txt.
2. Deny "read" to the file created in step 1.
a. Right mouse click on the file and choose Properties.
b. Go to the Security tab and uncheck Read permission for all users.
3. Run test program
4. The test will throw an exception and the file created in step 1 will be
deleted
EXPECTED VERSUS ACTUAL BEHAVIOR :
FileInputStream should not delete the file which can not be read
ERROR MESSAGES :
E:\tmpjava\179827_deletefile>java FileTest
java.io.FileNotFoundException: testfile.txt (The system cannot find the file specified)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
public class FileTest
{
public static void main(String[] args)
{
try
{
FileInputStream file = new FileInputStream("testfile.txt");
}
catch (IOException e)
{
System.out.println(e.toString());
}
}
}
---------- END SOURCE ----------
(Review ID: 179827)
======================================================================