Hi,

I was just reading the source of java/security/ProtectionDomain.java
and found a small bug. When an ProtectionDomain is created with a
PermissionCollection it is illegal to add any new Permissions to the
collection. I have added a small diff.

Is there a bug database somewhere?

Cheers,

Mark

---

--- java/security/ProtectionDomain.java 2000/03/16 20:18:22     1.2
+++ java/security/ProtectionDomain.java 2000/04/19 01:37:22
@@ -77,15 +77,23 @@
 /**
   * This method initializes a new instance of <code>ProtectionDomain</code>
   * representing the specified <code>CodeSource</code> and permission set.
+  * No permissions may be added to the <code>PermissionCollection</code>
+  * and this contructor will call the <code>setReadOnly</code> method on
+  * the specified permission set.
   *
   * @param code_source The <code>CodeSource</code> for this domain
   * @param perms The permission set for this domain
+  *
+  * @see java.security.PermissionCollection#setReadOnly()
   */
 public
 ProtectionDomain(CodeSource code_source, PermissionCollection perms)
 {
   this.code_source = code_source;
   this.perms = perms;
+  if (perms != null) {
+    perms.setReadOnly();
+  }
 }
 
 /*************************************************************************/

Reply via email to