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]);
		}
	}
}

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to