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

Thread.setContextClassLoader should use same RuntimePermission obj each time called when SM enabled

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • core-libs
    • None
    • sparc
    • solaris_10

      Thread.setContextClassLoader creates an unnecessary RuntimePermission object each
      time it is called when a SecurityManager is enabled:

       SecurityManager sm = System.getSecurityManager();
           if (sm != null) {
                  sm.checkPermission(new RuntimePermission("setContextClassLoader"));
           }
       
      This is unnecessary, a singleton should be used instead like the objects
      in sun.security.util.SecurityConstants, ex:

      public static final RuntimePermission SET_CONTEXT_CLASSLOADER_PERMISSION =
          new RuntimePermission("setContextClassLoader");

            mullan Sean Mullan
            mullan Sean Mullan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: