diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-20 13:43:35 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-20 13:43:35 +0000 |
commit | 6586aa928d1452978d5d01953262feef22d9d02f (patch) | |
tree | 7e4bc2de07ebff904c9e32b5f47d40e91f0a6395 /libjava/java/io/FileOutputStream.java | |
parent | 5e28fe9baae62a83779d42916d465e39357bd242 (diff) | |
download | gcc-6586aa928d1452978d5d01953262feef22d9d02f.tar.gz |
2004-04-20 Jeroen Frijters <jeroen@frijters.net>
* java/io/FileDescriptor.java: (FileDescriptor) Added public
constructor. (valid) Added null check.
2004-04-20 Guilhem Lavaux <guilhem@kaffe.org>
Reported by Nektarios Papadopoulos <npapadop@inaccessnetworks.com>
* java/io/FileOutputStream.java
(FileOutputStream) Reorganized constructors. Constructors now
check whether the given path is directory.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/FileOutputStream.java')
-rw-r--r-- | libjava/java/io/FileOutputStream.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java index a8c4b765ed2..8942871e43a 100644 --- a/libjava/java/io/FileOutputStream.java +++ b/libjava/java/io/FileOutputStream.java @@ -81,13 +81,7 @@ public class FileOutputStream extends OutputStream public FileOutputStream (String path, boolean append) throws SecurityException, FileNotFoundException { - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkWrite(path); - ch = new FileChannelImpl (path, (append - ? FileChannelImpl.WRITE - | FileChannelImpl.APPEND - : FileChannelImpl.WRITE)); + this (new File(path), append); } /** @@ -130,7 +124,7 @@ public class FileOutputStream extends OutputStream public FileOutputStream (File file) throws SecurityException, FileNotFoundException { - this (file.getPath(), false); + this (file, false); } /** @@ -156,7 +150,17 @@ public class FileOutputStream extends OutputStream public FileOutputStream (File file, boolean append) throws FileNotFoundException { - this (file.getPath(), append); + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkWrite(file.getPath()); + + if (file.isDirectory()) + throw new FileNotFoundException(file.getPath() + " is a directory"); + + ch = new FileChannelImpl (file.getPath(), (append + ? FileChannelImpl.WRITE + | FileChannelImpl.APPEND + : FileChannelImpl.WRITE)); } /** |