From 0329855831102a48abf14b5befc933f84dfd3460 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Fri, 8 Nov 2024 20:22:24 +0000 Subject: [PATCH] 8343804: Show the default time zone with -XshowSettings option Reviewed-by: iris, jpai --- .../share/classes/sun/launcher/LauncherHelper.java | 3 +++ test/jdk/tools/launcher/Settings.java | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/src/java.base/share/classes/sun/launcher/LauncherHelper.java index ccb82c84c92..cbcc61e332c 100644 --- a/src/java.base/share/classes/sun/launcher/LauncherHelper.java +++ b/src/java.base/share/classes/sun/launcher/LauncherHelper.java @@ -63,6 +63,7 @@ import java.util.Optional; import java.util.Properties; import java.util.ResourceBundle; import java.util.Set; +import java.util.TimeZone; import java.util.TreeSet; import java.util.function.Function; import java.util.jar.Attributes; @@ -318,6 +319,8 @@ public final class LauncherHelper { Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); + ostream.println(INDENT + "default timezone = " + + TimeZone.getDefault().getID()); ostream.println(INDENT + "tzdata version = " + ZoneInfoFile.getVersion()); if (verbose) { diff --git a/test/jdk/tools/launcher/Settings.java b/test/jdk/tools/launcher/Settings.java index 2b581be5b26..fe5a9c3b157 100644 --- a/test/jdk/tools/launcher/Settings.java +++ b/test/jdk/tools/launcher/Settings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ import java.io.IOException; /* * @test - * @bug 6994753 7123582 8305950 8281658 8310201 8311653 + * @bug 6994753 7123582 8305950 8281658 8310201 8311653 8343804 * @summary tests -XshowSettings options * @modules jdk.compiler * jdk.zipfs @@ -80,6 +80,7 @@ public class Settings extends TestHelper { private static final String SYSTEM_SETTINGS = "Operating System Metrics:"; private static final String METRICS_NOT_AVAILABLE_MSG = "No metrics available for this platform"; private static final String STACKSIZE_SETTINGS = "Stack Size:"; + private static final String TIMEZONE_SETTINGS = "default timezone"; private static final String TZDATA_SETTINGS = "tzdata version"; private static final String ERR_MSG = "Unrecognized showSettings option:"; @@ -96,6 +97,7 @@ public class Settings extends TestHelper { checkNotContains(tr, SEC_SUMMARY_PROPS_SETTINGS); checkContains(tr, SEC_PROVIDER_SETTINGS); checkContains(tr, SEC_TLS_SETTINGS); + checkContains(tr, TIMEZONE_SETTINGS); checkContains(tr, TZDATA_SETTINGS); if (System.getProperty("os.name").contains("Linux")) { checkContains(tr, SYSTEM_SETTINGS); @@ -119,6 +121,7 @@ public class Settings extends TestHelper { checkContains(tr, SEC_SUMMARY_PROPS_SETTINGS); checkContains(tr, SEC_PROVIDER_SETTINGS); checkContains(tr, SEC_TLS_SETTINGS); + checkContains(tr, TIMEZONE_SETTINGS); checkContains(tr, TZDATA_SETTINGS); if (System.getProperty("os.name").contains("Linux")) { checkContains(tr, SYSTEM_SETTINGS); @@ -190,6 +193,7 @@ public class Settings extends TestHelper { checkContains(tr, LOCALE_SETTINGS); checkContains(tr, AVAILABLE_LOCALES); checkNotContains(tr, LOCALE_SUMMARY_SETTINGS); + checkContains(tr, TIMEZONE_SETTINGS); checkContains(tr, TZDATA_SETTINGS); }