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

AccessController.checkPermission(PropertyPermission) does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.2.0
    • security-libs



      Name: mgC56079 Date: 11/01/98


      java.security.AccessController.checkPermission(PropertyPermission) does not work if
      there is no SecurityManager installed.
      The method incorrectly throws a SecurityException in this case.

      Here is the spec:
          /**
           * Determines whether the access request indicated by the
           * specified permission should be allowed or denied, based on
           * the security policy currently in effect.
           * This method quietly returns if the access request
           * is permitted, or throws a suitable AccessControlException otherwise.
           *
           * @param perm the requested permission.
           *
           * @exception AccessControlException if the specified permission
           * is not permitted, based on the current security policy.
           */

          public static void checkPermission(Permission perm)
      throws AccessControlException


      The bug was introduced in JDK1.2beta4 (works correctly in beta3)

      Here is the minimized test:
      ==== AccessControllerTests.java ====
      public class AccessControllerTests {

        public static void main( String argv[] ) {
          try {
            java.security.AccessController.checkPermission(
              new java.util.PropertyPermission("property", "write"));
            System.out.println("Passed");
          }
          catch (SecurityException e) {
              System.out.println("Unable to set system property");
              System.setProperty("property","some");
              System.out.println("Failed");
          }

        }
      }
      ==== sample run (jdk1.2fcsO), WRONG ====
      % java AccessControllerTests
      Unable to set system property
      Failed
      ==== sample run (jdk1.2beta3), correct ====
      % /set/java/jdk1.2-beta3/solaris/bin/java AccessControllerTests
      Passed


      ======================================================================

            rschemersunw Roland Schemers (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: