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

java.security.AccessControlContext.checkPermission(null) behavior not specified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.1
    • security-libs



      Name: ksC84122 Date: 03/12/99


      The javadoc does not specify behavior of
      java.security.AccessControlContext.checkPermission(null).
      checkPermission() tries to check if null permission is
      implied by context which does not make sense.
      It should throw NullPointerException.

      A test example which demonstrates this problem.
      ===== test44.java ========
      import java.security.*;

      public class test44 {

         public static void main (String argv[]) {
             SecurityManager sec = new SecurityManager();
             ProtectionDomain pd[] = new ProtectionDomain[1];
             AccessControlContext acc = new AccessControlContext(pd);
             
             try {
                 acc.checkPermission(null);
                 System.out.println("Failed: NullPointerException expected");
                 return;
             } catch (NullPointerException npe) { //OKAY
             }

             System.out.println("Passed.");
             return;
        }
      }

      ========= Sample run (JDK1.2.1) ==========
      #>java test44
      Failed: NullPointerException expected

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

            jlueheorcl Jan Luehe (Inactive)
            skosunw Sko Sko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: