8031525: Logger created in test/tools/jar/UpdateManifest.java might get gc'ed too early.
authordfuchs
Fri, 10 Jan 2014 19:48:02 +0100
changeset 22261 e82547d2e78a
parent 22260 c9185e010e03
child 22263 9328773ff3c5
8031525: Logger created in test/tools/jar/UpdateManifest.java might get gc'ed too early. Summary: The test needs to keep a strong reference on its loggers otherwise the modification of the logger level may only be transient. Reviewed-by: chegar
jdk/test/tools/jar/UpdateManifest.java
--- a/jdk/test/tools/jar/UpdateManifest.java	Fri Jan 10 09:24:47 2014 -0800
+++ b/jdk/test/tools/jar/UpdateManifest.java	Fri Jan 10 19:48:02 2014 +0100
@@ -39,6 +39,8 @@
     static PrintStream err = System.err;
     static boolean debug = true;
 
+    static final Logger JAR_LOGGER = Logger.getLogger("java.util.jar");
+
     public static void realMain(String[] args) throws Throwable {
         if (args.length == 0) {
             debug = false;
@@ -47,7 +49,7 @@
             out = new PrintStream(new FileOutputStream(tmp));
             err = out;
             // Attributes.read() can log a message we don't care to see.
-            Logger.getLogger("java.util.jar").setLevel(Level.OFF);
+            JAR_LOGGER.setLevel(Level.OFF);
         }
 
         try { testManifestExistence(); } catch (Throwable t) { unexpected(t); }