< prev index next >

src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs

*** 31,40 **** --- 31,41 ---- import java.util.Iterator; import java.util.Locale; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; import sun.security.util.SecurityConstants; + import sun.security.action.GetPropertyAction; /** * Helper class used to load the {@link java.lang.System.LoggerFinder}. */ public final class LoggerFinderLoader {
*** 77,89 **** return service; } // Get configuration error policy private static ErrorPolicy configurationErrorPolicy() { ! final PrivilegedAction<String> getConfigurationErrorPolicy = ! () -> System.getProperty("jdk.logger.finder.error"); ! String errorPolicy = AccessController.doPrivileged(getConfigurationErrorPolicy); if (errorPolicy == null || errorPolicy.isEmpty()) { return ErrorPolicy.WARNING; } try { return ErrorPolicy.valueOf(errorPolicy.toUpperCase(Locale.ROOT)); --- 78,89 ---- return service; } // Get configuration error policy private static ErrorPolicy configurationErrorPolicy() { ! String errorPolicy = ! GetPropertyAction.getProperty("jdk.logger.finder.error"); if (errorPolicy == null || errorPolicy.isEmpty()) { return ErrorPolicy.WARNING; } try { return ErrorPolicy.valueOf(errorPolicy.toUpperCase(Locale.ROOT));
*** 93,105 **** } // Whether multiple provider should be considered as an error. // This is further submitted to the configuration error policy. private static boolean ensureSingletonProvider() { ! final PrivilegedAction<Boolean> ensureSingletonProvider = ! () -> Boolean.getBoolean("jdk.logger.finder.singleton"); ! return AccessController.doPrivileged(ensureSingletonProvider); } private static Iterator<System.LoggerFinder> findLoggerFinderProviders() { final Iterator<System.LoggerFinder> iterator; if (System.getSecurityManager() == null) { --- 93,104 ---- } // Whether multiple provider should be considered as an error. // This is further submitted to the configuration error policy. private static boolean ensureSingletonProvider() { ! return Boolean.parseBoolean( ! GetPropertyAction.getProperty("jdk.logger.finder.singleton")); } private static Iterator<System.LoggerFinder> findLoggerFinderProviders() { final Iterator<System.LoggerFinder> iterator; if (System.getSecurityManager() == null) {
< prev index next >