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

incorrect SecurityException spec for Unsafe.getUnsafe

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • CPU:
      generic
    • OS:
      generic

      Description

      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?

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: