[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
small bug report for java.io.FileInputStream
From: |
Dalibor Topic |
Subject: |
small bug report for java.io.FileInputStream |
Date: |
Fri, 21 Nov 2003 16:24:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 |
Hi all,
the constructors in FileInputstream don't throw a FileNotFoundException
when the File to open as an InputStream is actually a directory, as they
should do. I've attached a test case that demonstrates the bug.
While there is a patch in kaffe for this bug, it existed in a previous
form in the old version of FileInputStream.java before it was replaced
by GNU Classpath's version[1], so I'd prefer to see a patch that can not
be seen as derived from GPL'd code.
I've attached a simple test case.
cheers,
dalibor topic
[1] Guilhem imported the file from Classpath, and fixed the bug. The
code is similar (there are not that many ways to check if a file is a
directory and throw an exception based on that) to the code from the
earlier, GPLd version, checked in by Jim Pick and written by Patrick
Tullman.
import java.io.*;
public class fistest {
private static void construct(String name) {
try {
FileInputStream fis = new FileInputStream(name);
System.out.println(fis);
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String [] args) {
String [] test = { "/tmp" };
for (int i = 0; i < test.length; i++) {
construct(test[i]);
}
}
}
- small bug report for java.io.FileInputStream,
Dalibor Topic <=