java.lang.SecurityManager.checkAccess(null) behavior not specified

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 1.2.2
    • Component/s: security-libs



      Name: ksC84122 Date: 02/26/99


      JDK 1.2.2 java.lang.SecurityManager.checkAccess(Thread t) throws NullPointerException
      if t==null, while java.lang.SecurityManager.checkAccess(ThreadGroup g) just returns silently
      if g==null. This behavior is inconsistent and it is not specified in the javadoc what is
      the right behavior for these methods in case of null parameter.

      A test example which demonstrates this problem.
      ===== test35.java ========
      public class test35 {

          public static void main (String argv[]) {
              ThreadGroup tg = null;
              Thread t = null;
              SecurityManager sm = new SecurityManager();
              
              try {
                  sm.checkAccess(t);
                  System.out.println("checkAccess(Thread) returns silently");
              } catch (NullPointerException npe) {
                  System.out.println("checkAccess(Thread) throws NullPointerException");
              }

              try {
                  sm.checkAccess(tg);
                  System.out.println("checkAccess(ThreadGroup) returns silently");
              } catch (NullPointerException npe) {
                  System.out.println("checkAccess(ThreadGroup) throws NullPointerException");
              }
              return;
          }

      }


      ========= Sample run (JDK1.2.2) ==========
      #>java test35
      checkAccess(Thread) throws NullPointerException
      checkAccess(ThreadGroup) returns silently

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

            Assignee:
            Sean Mullan
            Reporter:
            Sko Sko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: