[multiple changes]

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.

From-SVN: r80901
This commit is contained in:
Michael Koch 2004-04-20 13:43:35 +00:00
parent f6d49f66ec
commit 0fc920c8d5
3 changed files with 34 additions and 10 deletions

View file

@ -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));
}
/**