src/share/classes/java/util/PropertyPermission.java

Print this page

        

*** 128,141 **** * Also called during de-serialization. * * @param mask the actions mask to use. * */ ! ! private void init(int mask) ! { ! if ((mask & ALL) != mask) throw new IllegalArgumentException("invalid actions mask"); if (mask == NONE) throw new IllegalArgumentException("invalid actions mask"); --- 128,138 ---- * Also called during de-serialization. * * @param mask the actions mask to use. * */ ! private void init(int mask) { if ((mask & ALL) != mask) throw new IllegalArgumentException("invalid actions mask"); if (mask == NONE) throw new IllegalArgumentException("invalid actions mask");
*** 158,170 **** * * @throws NullPointerException if <code>name</code> is <code>null</code>. * @throws IllegalArgumentException if <code>name</code> is empty or if * <code>actions</code> is invalid. */ ! ! public PropertyPermission(String name, String actions) ! { super(name,actions); init(getMask(actions)); } /** --- 155,165 ---- * * @throws NullPointerException if <code>name</code> is <code>null</code>. * @throws IllegalArgumentException if <code>name</code> is empty or if * <code>actions</code> is invalid. */ ! public PropertyPermission(String name, String actions) { super(name,actions); init(getMask(actions)); } /**
*** 194,204 **** // They must be equal to that.mask for implies to return true. return ((this.mask & that.mask) == that.mask) && super.implies(that); } - /** * Checks two PropertyPermission objects for equality. Checks that <i>obj</i> is * a PropertyPermission, and has the same name and actions as this object. * <P> * @param obj the object we are testing for equality with this object. --- 189,198 ----
*** 224,243 **** * <code>getName().hashCode()</code>, where <code>getName</code> is * from the Permission superclass. * * @return a hash code value for this object. */ - public int hashCode() { return this.getName().hashCode(); } - /** * 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; --- 218,235 ---- * <code>getName().hashCode()</code>, where <code>getName</code> is * from the Permission superclass. * * @return a hash code value for this object. */ public int hashCode() { return this.getName().hashCode(); } /** * Converts an actions String to an actions mask. * ! * @param actions the action string. * @return the actions mask. */ private static int getMask(String actions) { int mask = NONE;
*** 330,341 **** * Always returns present actions in the following order: * read, write. * * @return the canonical string representation of the actions. */ ! static String getActions(int mask) ! { StringBuilder sb = new StringBuilder(); boolean comma = false; if ((mask & READ) == READ) { comma = true; --- 322,332 ---- * Always returns present actions in the following order: * read, write. * * @return the canonical string representation of the actions. */ ! static String getActions(int mask) { StringBuilder sb = new StringBuilder(); boolean comma = false; if ((mask & READ) == READ) { comma = true;
*** 357,368 **** * allows both write and read actions, a call to <code>getActions</code> * will return the string "read,write". * * @return the canonical string representation of the actions. */ ! public String getActions() ! { if (actions == null) actions = getActions(this.mask); return actions; } --- 348,358 ---- * allows both write and read actions, a call to <code>getActions</code> * will return the string "read,write". * * @return the canonical string representation of the actions. */ ! public String getActions() { if (actions == null) actions = getActions(this.mask); return actions; }
*** 371,381 **** * Return the current action mask. * Used by the PropertyPermissionCollection * * @return the actions mask. */ - int getMask() { return mask; } /** --- 361,370 ----
*** 384,394 **** * <p> * * @return a new PermissionCollection object suitable for storing * PropertyPermissions. */ - public PermissionCollection newPermissionCollection() { return new PropertyPermissionCollection(); } --- 373,382 ----
*** 434,444 **** * @author Roland Schemers * * @serial include */ final class PropertyPermissionCollection extends PermissionCollection ! implements Serializable { /** * Key is property name; value is PropertyPermission. * Not serialized; see serialization section at end of class. --- 422,432 ---- * @author Roland Schemers * * @serial include */ final class PropertyPermissionCollection extends PermissionCollection ! implements Serializable { /** * Key is property name; value is PropertyPermission. * Not serialized; see serialization section at end of class.
*** 452,465 **** */ // No sync access; OK for this to be stale. private boolean all_allowed; /** ! * Create an empty PropertyPermissions object. ! * */ - public PropertyPermissionCollection() { perms = new HashMap<>(32); // Capacity for default policy all_allowed = false; } --- 440,451 ---- */ // No sync access; OK for this to be stale. private boolean all_allowed; /** ! * Create an empty PropertyPermissionCollection object. */ public PropertyPermissionCollection() { perms = new HashMap<>(32); // Capacity for default policy all_allowed = false; }
*** 473,485 **** * PropertyPermission * * @exception SecurityException - if this PropertyPermissionCollection * object has been marked readonly */ ! ! public void add(Permission permission) ! { if (! (permission instanceof PropertyPermission)) throw new IllegalArgumentException("invalid permission: "+ permission); if (isReadOnly()) throw new SecurityException( --- 459,469 ---- * PropertyPermission * * @exception SecurityException - if this PropertyPermissionCollection * object has been marked readonly */ ! public void add(Permission permission) { if (! (permission instanceof PropertyPermission)) throw new IllegalArgumentException("invalid permission: "+ permission); if (isReadOnly()) throw new SecurityException(
*** 512,529 **** /** * Check and see if this set of permissions implies the permissions * expressed in "permission". * ! * @param p the Permission object to compare * * @return true if "permission" is a proper subset of a permission in * the set, false if not. */ ! ! public boolean implies(Permission permission) ! { if (! (permission instanceof PropertyPermission)) return false; PropertyPermission pp = (PropertyPermission) permission; PropertyPermission x; --- 496,511 ---- /** * Check and see if this set of permissions implies the permissions * expressed in "permission". * ! * @param permission the Permission object to compare * * @return true if "permission" is a proper subset of a permission in * the set, false if not. */ ! public boolean implies(Permission permission) { if (! (permission instanceof PropertyPermission)) return false; PropertyPermission pp = (PropertyPermission) permission; PropertyPermission x;
*** 653,664 **** /* * Reads in a Hashtable of PropertyPermissions and saves them in the * perms field. Reads in all_allowed. */ ! private void readObject(ObjectInputStream in) throws IOException, ! ClassNotFoundException { // Don't call defaultReadObject() // Read in serialized fields ObjectInputStream.GetField gfields = in.readFields(); --- 635,647 ---- /* * Reads in a Hashtable of PropertyPermissions and saves them in the * perms field. Reads in all_allowed. */ ! private void readObject(ObjectInputStream in) ! throws IOException, ClassNotFoundException ! { // Don't call defaultReadObject() // Read in serialized fields ObjectInputStream.GetField gfields = in.readFields();