Name: mc57594 Date: 02/12/97
If I construct a java.io.FileWriter for a file which is being
held open by the "more" program (Windows NT), it throws
java.io.FileNotFoundException. In fact, the file is present.
The following program demonstrates this if it's run while the
argument file is held open in a "-- More --" prompt.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
public
class tt2 {
static public void main(String argv[]) throws IOException {
if (argv[1].equals("R")) {
new BufferedReader(new FileReader(new File(argv[0])));
System.out.println("opened db R");
}
else {
new FileWriter(new File(argv[0]));
System.out.println("opened db W");
}
System.in.read();
}
}
D:\temp>java tt2 foo.bar W
java.io.FileNotFoundException: foo.bar
at java.io.FileOutputStream.<init>(FileOutputStream.java:59)
at java.io.FileOutputStream.<init>(FileOutputStream.java:93)
at java.io.FileWriter.<init>(FileWriter.java:50)
at tt2.main(tt2.java:17)
company - Object Design, Inc. , email - ###@###.###
======================================================================
- duplicates
-
JDK-4079140 IOException should have subclasses to better describe failure
-
- Closed
-