LogManager specification mentions LoggingPermission("control") which is not instantiatable

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P4
    • None
    • Affects Version/s: 21
    • Component/s: core-libs
    • None

      Various methods of

        https://docs.oracle.com/en/java/javase/21/docs/api/java.logging/java/util/logging/LogManager.html

      assert

        SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control").

      However it's not possible to instantiate LoggingPermission("control"),
      there's no one-arg constructor https://docs.oracle.com/en/java/javase/21/docs/api/java.logging/java/util/logging/LoggingPermission.html

      Moreover it's not possible to instantiate anything other than new LoggingPermission("control", "") or LoggingPermission("control", null)

      The OpenJDK's implementation of LogManager contains:

      static final Permission controlPermission =
                  new LoggingPermission("control", null);

          void checkPermission() {
              @SuppressWarnings("removal")
              SecurityManager sm = System.getSecurityManager();
              if (sm != null)
                  sm.checkPermission(controlPermission);
          }

      So the LogManager's spec could be improved to say for example:

      SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control", null).

      or simply

      SecurityException - if a security manager exists and if the caller does not have LoggingPermission.

            Assignee:
            Daniel Fuchs
            Reporter:
            Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: