Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6551491

Spec requirements about homogenous permission collections are inconsistent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 7
    • security-libs
    • None

      Specification of PermissionCollection class tells following:

      "The PermissionCollection returned by the Permission.newPermissionCollection method is a homogeneous collection, which stores only Permission objects for a given Permission type. "

      There is still chance for newPermissionCollection method to return null however if non-null is returned then it should be permission collection allowing just instances of corespondign class to be added.

      Yet it is specified that "The default behavior (from the Permission class) is to simply return null."

      All these together implicitly means that:

      1. direct subclasses of Permission class may just inherit method newPermissionCollection from
      parent.
      2. statement #1 is appllicable to direct subclasses of classes satisfied with it recursively.
      3. *Important*. If some class redefines newPermissionCollection method to return non-null value then all it's direct subclasses should redefine this method too - otherwise inherited method will return instalce of PermissionCollection capable to store instances of classes which are parent's or siblings of this one. This rule is applicable recursively too.
      4. If some direct class defines newPermissionCollection returning null while it's super class returns non-null then statement #1 then above rules are applied in assumption that Permission is replacedd by such class.

      However there are several classes which violate these implicit requirements (they are subclasses of BasicPermission that do not override newPermissionCollection method) which means that permission collections returned by 'newPermissionCollection' invoked for their instances are not homogenous:

      javax.sound.sampled.AudioPermission
      javax.security.auth.AuthPermission
      java.awt.AWTPermission
      java.util.logging.LoggingPermission
      java.lang.management.ManagementPermission
      javax.management.MBeanTrustPermission
      java.net.NetPermission
      java.lang.reflect.ReflectPermission
      java.lang.RuntimePermission
      java.security.SecurityPermission
      java.io.SerializablePermission
      java.sql.SQLPermission
      javax.net.ssl.SSLPermission
      javax.management.remote.SubjectDelegationPermission
      javax.xml.ws.WebServicePermission

      Good example of BasicPermission subclass is java.util.PropertyPermission.

            weijun Weijun Wang
            sreznick Sergey Reznick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: