To: ###@###.###
Subject: FileWriter throws wrong exception
Comments: Hyperbole mail buttons accepted, v3.16.
From: Steve Kelem <###@###.###>
java.io.FileWriter throws the FileNotFoundException when trying to write to
a read-only file.
Here's some sample code that exercises the bug. You will need to create a
read-only file called "a" to exercise the bug.
import java.io.*;
import java.util.*;
public class iotest {
static FileWriter ftarget = null;
static PrintWriter target = null;
/**
* Constructor.
*/
public iotest() {
}
static void write_files(String File_A)
throws IOException
{
ftarget = new FileWriter(File_A);
target = new PrintWriter(ftarget);
target.println("This is line 1 of file A.");
ftarget.flush();
ftarget.close();
}
public static void main(String args[])
throws IOException
{
write_files("a");
}
}
I hope this helps,
/7\'7 Steve Kelem (408)879-5347 ###@###.###
\\ ` Xilinx FAX: (408)377-3259
// 2100 Logic Drive
\\/.\ San Jose, California 95124
****
This is reproducable on build 122.
sfoster@eng 1997-06-10
Subject: FileWriter throws wrong exception
Comments: Hyperbole mail buttons accepted, v3.16.
From: Steve Kelem <###@###.###>
java.io.FileWriter throws the FileNotFoundException when trying to write to
a read-only file.
Here's some sample code that exercises the bug. You will need to create a
read-only file called "a" to exercise the bug.
import java.io.*;
import java.util.*;
public class iotest {
static FileWriter ftarget = null;
static PrintWriter target = null;
/**
* Constructor.
*/
public iotest() {
}
static void write_files(String File_A)
throws IOException
{
ftarget = new FileWriter(File_A);
target = new PrintWriter(ftarget);
target.println("This is line 1 of file A.");
ftarget.flush();
ftarget.close();
}
public static void main(String args[])
throws IOException
{
write_files("a");
}
}
I hope this helps,
/7\'7 Steve Kelem (408)879-5347 ###@###.###
\\ ` Xilinx FAX: (408)377-3259
// 2100 Logic Drive
\\/.\ San Jose, California 95124
****
This is reproducable on build 122.
sfoster@eng 1997-06-10
- duplicates
-
JDK-4411409 java.io.FileWriter has incorrect throws tags
- Closed