OpenJDK / jdk / jdk
changeset 54459:e5713cefcf41
8222027: java/util/logging/LogManager/TestLoggerNames.java generates intermittent ClassCastException
Summary: Make a strong reference to TestLogger and dont fetch it from LogManager
Reviewed-by: dfuchs
author | sgroeger |
---|---|
date | Mon, 08 Apr 2019 15:01:39 +0100 |
parents | 0608ef3a7740 |
children | 6733a9176cce |
files | test/jdk/java/util/logging/LogManager/TestLoggerNames.java |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/test/jdk/java/util/logging/LogManager/TestLoggerNames.java Mon Apr 08 18:42:29 2019 +0200 +++ b/test/jdk/java/util/logging/LogManager/TestLoggerNames.java Mon Apr 08 15:01:39 2019 +0100 @@ -133,7 +133,8 @@ public static void main(String[] args) throws InterruptedException { - LogManager.getLogManager().addLogger(new TestLogger("com.foo.bar.zzz", null)); + TestLogger test = new TestLogger("com.foo.bar.zzz", null); + LogManager.getLogManager().addLogger(test); try { Logger.getLogger(null); throw new RuntimeException("Logger.getLogger(null) didn't throw expected NPE"); @@ -144,7 +145,9 @@ loggers.add(Logger.getLogger("one.two.addMeAChild")); loggers.add(Logger.getLogger("aaa.bbb.replaceMe")); loggers.add(Logger.getLogger("bbb.aaa.addMeAChild")); - TestLogger test = (TestLogger)Logger.getLogger("com.foo.bar.zzz"); + if (test != Logger.getLogger("com.foo.bar.zzz")) { + throw new AssertionError("wrong logger returned"); + } loggers.add(Logger.getLogger("ddd.aaa.addMeAChild")); checkLoggerNames(loggers);