2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>

* java/io/FileInputStream.java
	(FileInputStream(String)): Call FileInputStream(File).
	(FileInputStream(File)): Check whether the argument is a directory.

From-SVN: r75039
This commit is contained in:
Guilhem Lavaux 2003-12-26 21:11:03 +00:00 committed by Michael Koch
parent 06fc4e4186
commit 88f2e10376
2 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
* java/io/FileInputStream.java
(FileInputStream(String)): Call FileInputStream(File).
(FileInputStream(File)): Check whether the argument is a directory.
2003-12-26 Michael Koch <konqueror@gmx.de>
* Makefile.am (rmi_java_source_files):

View File

@ -79,11 +79,7 @@ public class FileInputStream extends InputStream
*/
public FileInputStream(String name) throws FileNotFoundException
{
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkRead(name);
fd = new FileDescriptor(name, FileDescriptor.READ);
this(new File(name));
}
/**
@ -104,7 +100,14 @@ public class FileInputStream extends InputStream
*/
public FileInputStream(File file) throws FileNotFoundException
{
this(file.getPath());
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkRead(file.getPath());
if (file.isDirectory())
throw new FileNotFoundException(file.getPath() + " is a directory");
fd = new FileDescriptor(file.getPath(), FileDescriptor.READ);
}
/**