8033542: test/java/util/logging/SimpleLogManager might let Loggers be gc'ed too early.
Summary: fix another case of potentially premature Logger garbage collection in tests.
Reviewed-by: mchung
--- a/jdk/test/java/util/logging/SimpleLogManager.java Wed Feb 05 10:59:55 2014 -0500
+++ b/jdk/test/java/util/logging/SimpleLogManager.java Wed Feb 05 17:56:04 2014 +0100
@@ -98,16 +98,14 @@
return false;
}
CustomLogger newLogger = new CustomLogger(logger);
- super.addLogger(newLogger);
- return true;
+ return super.addLogger(newLogger);
}
public class CustomLogger extends Logger {
+ final Logger keepRef; // keep a strong reference to avoid GC.
CustomLogger(Logger logger) {
super(logger.getName(), logger.getResourceBundleName());
- }
- CustomLogger(String name) {
- super(name, null);
+ keepRef = logger;
}
}
}