< prev index next >
test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -53,11 +53,11 @@
* @bug 8140364
* @summary JDK implementation specific unit test for JDK internal API.
* Tests a naive implementation of System.Logger, and in particular
* the default mapping provided by PlatformLogger.
* @modules java.base/sun.util.logging
- * @build CustomSystemClassLoader BasePlatformLoggerTest
+ * @build CustomSystemClassLoader BaseLoggerFinder BasePlatformLoggerTest
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOSECURITY
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOPERMISSIONS
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest WITHPERMISSIONS
* @author danielfuchs
*/
@@ -88,11 +88,11 @@
};
static final Class<?> providerClass;
static {
try {
- providerClass = ClassLoader.getSystemClassLoader().loadClass("BasePlatformLoggerTest$BaseLoggerFinder");
+ providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder");
} catch (ClassNotFoundException ex) {
throw new ExceptionInInitializerError(ex);
}
}
@@ -328,27 +328,10 @@
}
public Logger getLogger(String name, Module caller);
}
- public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
- @Override
- public Logger getLogger(String name, Module caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(LOGGERFINDER_PERMISSION);
- }
- PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
- ClassLoader callerLoader = AccessController.doPrivileged(pa);
- if (callerLoader == null) {
- return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- } else {
- return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- }
- }
- }
-
static PlatformLogger getPlatformLogger(String name) {
boolean old = allowAccess.get().get();
allowAccess.get().set(true);
try {
return PlatformLogger.getLogger(name);
< prev index next >