src/share/classes/java/io/FilePermission.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 29,42 ****
import java.util.Enumeration;
import java.util.List;
import java.util.ArrayList;
import java.util.Vector;
import java.util.Collections;
- import java.io.ObjectStreamField;
- import java.io.ObjectOutputStream;
- import java.io.ObjectInputStream;
- import java.io.IOException;
import sun.security.util.SecurityConstants;
/**
* This class represents access to a file or directory. A FilePermission consists
* of a pathname and a set of actions valid for that pathname.
--- 29,38 ----
*** 422,434 ****
}
/**
* Converts an actions String to an actions mask.
*
! * @param action the action string.
* @return the actions mask.
*/
private static int getMask(String actions) {
int mask = NONE;
// Null action valid?
--- 418,431 ----
}
/**
* Converts an actions String to an actions mask.
*
! * @param actions the action string.
* @return the actions mask.
*/
+ @SuppressWarnings("fallthrough")
private static int getMask(String actions) {
int mask = NONE;
// Null action valid?
*** 796,806 ****
* container.
*
* @return an enumeration of all the FilePermission objects.
*/
! public Enumeration elements() {
// Convert Iterator into Enumeration
synchronized (this) {
return Collections.enumeration(perms);
}
}
--- 793,803 ----
* container.
*
* @return an enumeration of all the FilePermission objects.
*/
! public Enumeration<Permission> elements() {
// Convert Iterator into Enumeration
synchronized (this) {
return Collections.enumeration(perms);
}
}
*** 841,859 ****
}
/*
* Reads in a Vector of FilePermissions and saves them in the perms field.
*/
- @SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Don't call defaultReadObject()
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();
// Get the one we want
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
perms = new ArrayList<>(permissions.size());
perms.addAll(permissions);
}
}
--- 838,856 ----
}
/*
* Reads in a Vector of FilePermissions and saves them in the perms field.
*/
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Don't call defaultReadObject()
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();
// Get the one we want
+ @SuppressWarnings("unchecked")
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
perms = new ArrayList<>(permissions.size());
perms.addAll(permissions);
}
}