equal
deleted
inserted
replaced
29 import java.util.Hashtable; |
29 import java.util.Hashtable; |
30 import java.util.NoSuchElementException; |
30 import java.util.NoSuchElementException; |
31 import java.util.Map; |
31 import java.util.Map; |
32 import java.util.HashMap; |
32 import java.util.HashMap; |
33 import java.util.List; |
33 import java.util.List; |
34 import java.util.ArrayList; |
|
35 import java.util.Iterator; |
34 import java.util.Iterator; |
36 import java.util.Collections; |
35 import java.util.Collections; |
37 import java.io.Serializable; |
36 import java.io.Serializable; |
38 import java.io.ObjectStreamField; |
37 import java.io.ObjectStreamField; |
39 import java.io.ObjectOutputStream; |
38 import java.io.ObjectOutputStream; |
236 * adding an empty PermissionCollection that will just return false. |
235 * adding an empty PermissionCollection that will just return false. |
237 * It should be set to true when invoked from add(). |
236 * It should be set to true when invoked from add(). |
238 */ |
237 */ |
239 private PermissionCollection getPermissionCollection(Permission p, |
238 private PermissionCollection getPermissionCollection(Permission p, |
240 boolean createEmpty) { |
239 boolean createEmpty) { |
241 Class c = p.getClass(); |
240 Class<?> c = p.getClass(); |
242 |
241 |
243 PermissionCollection pc = permsMap.get(c); |
242 PermissionCollection pc = permsMap.get(c); |
244 |
243 |
245 if (!hasUnresolved && !createEmpty) { |
244 if (!hasUnresolved && !createEmpty) { |
246 return pc; |
245 return pc; |
388 |
387 |
389 // Get allPermission |
388 // Get allPermission |
390 allPermission = (PermissionCollection) gfields.get("allPermission", null); |
389 allPermission = (PermissionCollection) gfields.get("allPermission", null); |
391 |
390 |
392 // Get permissions |
391 // Get permissions |
|
392 // writeObject writes a Hashtable<Class<?>, PermissionCollection> for |
|
393 // the perms key, so this cast is safe, unless the data is corrupt. |
|
394 @SuppressWarnings("unchecked") |
393 Hashtable<Class<?>, PermissionCollection> perms = |
395 Hashtable<Class<?>, PermissionCollection> perms = |
394 (Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null); |
396 (Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null); |
395 permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2); |
397 permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2); |
396 permsMap.putAll(perms); |
398 permsMap.putAll(perms); |
397 |
399 |
588 |
590 |
589 // Read in serialized fields |
591 // Read in serialized fields |
590 ObjectInputStream.GetField gfields = in.readFields(); |
592 ObjectInputStream.GetField gfields = in.readFields(); |
591 |
593 |
592 // Get permissions |
594 // Get permissions |
|
595 // writeObject writes a Hashtable<Class<?>, PermissionCollection> for |
|
596 // the perms key, so this cast is safe, unless the data is corrupt. |
|
597 @SuppressWarnings("unchecked") |
593 Hashtable<Permission, Permission> perms = |
598 Hashtable<Permission, Permission> perms = |
594 (Hashtable<Permission, Permission>)gfields.get("perms", null); |
599 (Hashtable<Permission, Permission>)gfields.get("perms", null); |
595 permsMap = new HashMap<Permission, Permission>(perms.size()*2); |
600 permsMap = new HashMap<Permission, Permission>(perms.size()*2); |
596 permsMap.putAll(perms); |
601 permsMap.putAll(perms); |
597 } |
602 } |