mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8344077: Remove security manager dependency in java.io
Reviewed-by: rriggs, alanb, naoto, lancea
This commit is contained in:
parent
f6f73ce70d
commit
81e43114ec
9 changed files with 41 additions and 273 deletions
|
@ -199,23 +199,15 @@ public class FileOutputStream extends OutputStream
|
|||
public FileOutputStream(File file, boolean append)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
String name = (file != null ? file.getPath() : null);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(name);
|
||||
}
|
||||
if (name == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (file.isInvalid()) {
|
||||
throw new FileNotFoundException("Invalid file path");
|
||||
}
|
||||
this.path = file.getPath();
|
||||
|
||||
this.fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
this.path = name;
|
||||
|
||||
open(name, append);
|
||||
open(this.path, append);
|
||||
FileCleanable.register(fd); // open sets the fd, register the cleanup
|
||||
}
|
||||
|
||||
|
@ -236,14 +228,9 @@ public class FileOutputStream extends OutputStream
|
|||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public FileOutputStream(FileDescriptor fdObj) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (fdObj == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (security != null) {
|
||||
security.checkWrite(fdObj);
|
||||
}
|
||||
this.fd = fdObj;
|
||||
this.path = null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue