< prev index next >
src/share/classes/java/security/Permissions.java
Print this page
rev 1387 : 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
Reviewed-by: xuelei, mullan
Contributed-by: alexandre.boulgakov@oracle.com
*** 29,39 ****
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
- import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;
import java.io.Serializable;
import java.io.ObjectStreamField;
import java.io.ObjectOutputStream;
--- 29,38 ----
*** 236,246 ****
* adding an empty PermissionCollection that will just return false.
* It should be set to true when invoked from add().
*/
private PermissionCollection getPermissionCollection(Permission p,
boolean createEmpty) {
! Class c = p.getClass();
PermissionCollection pc = permsMap.get(c);
if (!hasUnresolved && !createEmpty) {
return pc;
--- 235,245 ----
* adding an empty PermissionCollection that will just return false.
* It should be set to true when invoked from add().
*/
private PermissionCollection getPermissionCollection(Permission p,
boolean createEmpty) {
! Class<?> c = p.getClass();
PermissionCollection pc = permsMap.get(c);
if (!hasUnresolved && !createEmpty) {
return pc;
*** 388,397 ****
--- 387,399 ----
// Get allPermission
allPermission = (PermissionCollection) gfields.get("allPermission", null);
// Get permissions
+ // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
+ // the perms key, so this cast is safe, unless the data is corrupt.
+ @SuppressWarnings("unchecked")
Hashtable<Class<?>, PermissionCollection> perms =
(Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2);
permsMap.putAll(perms);
*** 588,597 ****
--- 590,602 ----
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();
// Get permissions
+ // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
+ // the perms key, so this cast is safe, unless the data is corrupt.
+ @SuppressWarnings("unchecked")
Hashtable<Permission, Permission> perms =
(Hashtable<Permission, Permission>)gfields.get("perms", null);
permsMap = new HashMap<Permission, Permission>(perms.size()*2);
permsMap.putAll(perms);
}
< prev index next >