8156153: java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java fails with java.lang.RuntimeException
authordfuchs
Wed, 11 May 2016 19:23:58 +0200
changeset 37891 f15f7cb8b9fc
parent 37890 f6cb5112c878
child 37892 55da13d60938
8156153: java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java fails with java.lang.RuntimeException Summary: runs each scenario in its own VM to avoid unwanted interaction and start from a clean slate. Reviewed-by: mchung
jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java
--- a/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Tue May 10 14:51:29 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Wed May 11 19:23:58 2016 +0200
@@ -59,7 +59,9 @@
  * @modules java.base/sun.util.logging
  *          java.base/jdk.internal.logger
  *          java.logging/sun.util.logging.internal
- * @run  main/othervm DefaultLoggerBridgeTest
+ * @run  main/othervm DefaultLoggerBridgeTest NOSECURITY
+ * @run  main/othervm DefaultLoggerBridgeTest NOPERMISSIONS
+ * @run  main/othervm DefaultLoggerBridgeTest WITHPERMISSIONS
  * @author danielfuchs
  */
 public class DefaultLoggerBridgeTest {
@@ -275,7 +277,6 @@
             };
 
         Stream.of(args).map(TestCases::valueOf).forEach((testCase) -> {
-            LoggerFinder provider;
             switch (testCase) {
                 case NOSECURITY:
                     System.out.println("\n*** Without Security Manager\n");
@@ -396,10 +397,10 @@
         final boolean old = allowAll.get().get();
         allowAll.get().set(true);
         try {
+            appSink = LoggingProviderImpl.getLogManagerAccess().demandLoggerFor(
+                    LogManager.getLogManager(), "foo", DefaultLoggerBridgeTest.class.getModule());
             sysSink = LoggingProviderImpl.getLogManagerAccess().demandLoggerFor(
                     LogManager.getLogManager(), "foo", Thread.class.getModule());
-            appSink = LoggingProviderImpl.getLogManagerAccess().demandLoggerFor(
-                    LogManager.getLogManager(), "foo", DefaultLoggerBridgeTest.class.getModule());
             if (appSink == sysSink) {
                 throw new RuntimeException("identical backend loggers");
             }