< prev index next >

src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java

Print this page

        

*** 30,39 **** --- 30,40 ---- import java.security.PrivilegedAction; import java.util.ResourceBundle; import java.util.function.Supplier; import java.lang.System.LoggerFinder; import java.lang.System.Logger; + import java.lang.reflect.Module; import java.util.Objects; import java.util.logging.LogManager; import jdk.internal.logger.DefaultLoggerFinder; import java.util.logging.LoggingPermission; import sun.util.logging.PlatformLogger;
*** 396,420 **** } /** ! * Creates a java.util.logging.Logger for the given caller. * @param name the logger name. ! * @param caller the caller for which the logger should be created. ! * @return a Logger suitable for use in the given caller. */ private static java.util.logging.Logger demandJULLoggerFor(final String name, ! /* Module */ ! final Class<?> caller) { final LogManager manager = LogManager.getLogManager(); final SecurityManager sm = System.getSecurityManager(); if (sm == null) { ! return logManagerAccess.demandLoggerFor(manager, name, caller); } else { final PrivilegedAction<java.util.logging.Logger> pa = ! () -> logManagerAccess.demandLoggerFor(manager, name, caller); return AccessController.doPrivileged(pa, null, LOGGING_CONTROL_PERMISSION); } } /** --- 397,420 ---- } /** ! * Creates a java.util.logging.Logger for the given module. * @param name the logger name. ! * @param module the module for which the logger should be created. ! * @return a Logger suitable for use in the given module. */ private static java.util.logging.Logger demandJULLoggerFor(final String name, ! Module module) { final LogManager manager = LogManager.getLogManager(); final SecurityManager sm = System.getSecurityManager(); if (sm == null) { ! return logManagerAccess.demandLoggerFor(manager, name, module); } else { final PrivilegedAction<java.util.logging.Logger> pa = ! () -> logManagerAccess.demandLoggerFor(manager, name, module); return AccessController.doPrivileged(pa, null, LOGGING_CONTROL_PERMISSION); } } /**
*** 427,447 **** * @return {@inheritDoc} * @throws SecurityException if the calling code doesn't have the * {@code RuntimePermission("loggerFinder")}. */ @Override ! protected Logger demandLoggerFor(String name, /* Module */ Class<?> caller) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(LOGGERFINDER_PERMISSION); } ! return JULWrapper.of(demandJULLoggerFor(name,caller)); } public static interface LogManagerAccess { java.util.logging.Logger demandLoggerFor(LogManager manager, ! String name, /* Module */ Class<?> caller); } // Hook for tests public static LogManagerAccess getLogManagerAccess() { final SecurityManager sm = System.getSecurityManager(); --- 427,447 ---- * @return {@inheritDoc} * @throws SecurityException if the calling code doesn't have the * {@code RuntimePermission("loggerFinder")}. */ @Override ! protected Logger demandLoggerFor(String name, Module module) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(LOGGERFINDER_PERMISSION); } ! return JULWrapper.of(demandJULLoggerFor(name,module)); } public static interface LogManagerAccess { java.util.logging.Logger demandLoggerFor(LogManager manager, ! String name, Module module); } // Hook for tests public static LogManagerAccess getLogManagerAccess() { final SecurityManager sm = System.getSecurityManager();
< prev index next >