--- old/test/jdk/java/util/Locale/LocaleProviders.java 2020-05-20 09:20:53.000000000 -0700 +++ new/test/jdk/java/util/Locale/LocaleProviders.java 2020-05-20 09:20:52.000000000 -0700 @@ -23,10 +23,16 @@ import java.text.*; import java.text.spi.*; import java.util.*; +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.logging.LogRecord; +import java.util.logging.StreamHandler; import java.util.spi.*; import java.util.stream.IntStream; import sun.util.locale.provider.LocaleProviderAdapter; +import static java.util.logging.LogManager.*; + public class LocaleProviders { private static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows"); @@ -92,6 +98,10 @@ bug8232860Test(); break; + case "bug8245241Test": + bug8245241Test(args[1]); + break; + default: throw new RuntimeException("Test method '"+methodName+"' not found."); } @@ -227,7 +237,7 @@ System.out.println(new SimpleDateFormat("z", new Locale(lang, ctry)).parse("UTC")); } catch (ParseException pe) { // ParseException is fine in this test, as it's not "UTC" -} + } } static void bug8013903Test() { @@ -374,4 +384,24 @@ "provider is not HOST: " + type); } } + + static void bug8245241Test(String expected) { + LogRecord[] lra = new LogRecord[1]; + StreamHandler handler = new StreamHandler() { + @Override + public void publish(LogRecord record) { + lra[0] = record; + } + }; + getLogManager().getLogger("").addHandler(handler); + + DateFormat.getDateInstance(); // this will init LocaleProviderAdapter + handler.flush(); + + if (lra[0] == null || + lra[0].getLevel() != Level.INFO || + !lra[0].getMessage().equals(expected)) { + throw new RuntimeException("Expected log was not emitted. LogRecord: " + lra[0]); + } + } }