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:
parent
06fc4e4186
commit
88f2e10376
2 changed files with 15 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue