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

incorrect SecurityException spec for Unsafe.getUnsafe

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • core-libs
    • generic
    • generic

      In Unsafe.java I see:

           * @exception SecurityException if a security manager exists and its
           * <code>checkPropertiesAccess</code> method doesn't allow
           * access to the system properties.
           */
          @CallerSensitive
          public static Unsafe getUnsafe() {
              Class<?> caller = Reflection.getCallerClass();
              if (!VM.isSystemDomainLoader(caller.getClassLoader()))
                  throw new SecurityException("Unsafe");
              return theUnsafe;
          }

      but the spec looks wrong because it doesn't check whether there is a security manager, unlike code elsewhere. And what's up with checkPropertiesAccess?

            srastogi Shilpi Rastogi (Inactive)
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: