Skip to content

Commit ed57c7c

Browse files
committed
8343804: Show the default time zone with -XshowSettings option
Reviewed-by: phh Backport-of: 0329855831102a48abf14b5befc933f84dfd3460
1 parent 950b4ff commit ed57c7c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/java.base/share/classes/sun/launcher/LauncherHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import java.util.Properties;
7272
import java.util.ResourceBundle;
7373
import java.util.Set;
74+
import java.util.TimeZone;
7475
import java.util.TreeSet;
7576
import java.util.jar.Attributes;
7677
import java.util.jar.JarFile;
@@ -295,6 +296,8 @@ private static void printLocale(boolean summaryMode) {
295296
Locale.getDefault(Category.DISPLAY).getDisplayName());
296297
ostream.println(INDENT + "default format locale = " +
297298
Locale.getDefault(Category.FORMAT).getDisplayName());
299+
ostream.println(INDENT + "default timezone = " +
300+
TimeZone.getDefault().getID());
298301
ostream.println(INDENT + "tzdata version = " +
299302
ZoneInfoFile.getVersion());
300303
if (!summaryMode) {

test/jdk/tools/launcher/Settings.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -79,6 +79,7 @@ static void checkNotContains(TestResult tr, String str) {
7979
private static final String BAD_SEC_OPTION_MSG = "Unrecognized security subcommand";
8080
private static final String SYSTEM_SETTINGS = "Operating System Metrics:";
8181
private static final String STACKSIZE_SETTINGS = "Stack Size:";
82+
private static final String TIMEZONE_SETTINGS = "default timezone";
8283
private static final String TZDATA_SETTINGS = "tzdata version";
8384

8485
static void containsAllOptions(TestResult tr) {
@@ -92,6 +93,7 @@ static void containsAllOptions(TestResult tr) {
9293
checkContains(tr, SEC_SUMMARY_PROPS_SETTINGS);
9394
checkContains(tr, SEC_PROVIDER_SETTINGS);
9495
checkContains(tr, SEC_TLS_SETTINGS);
96+
checkContains(tr, TIMEZONE_SETTINGS);
9597
checkContains(tr, TZDATA_SETTINGS);
9698
if (System.getProperty("os.name").contains("Linux")) {
9799
checkContains(tr, SYSTEM_SETTINGS);
@@ -160,6 +162,7 @@ static void runTestOptionLocale() throws IOException {
160162
checkContains(tr, LOCALE_SETTINGS);
161163
checkContains(tr, AVAILABLE_LOCALES);
162164
checkNotContains(tr, LOCALE_SUMMARY_SETTINGS);
165+
checkContains(tr, TIMEZONE_SETTINGS);
163166
checkContains(tr, TZDATA_SETTINGS);
164167
}
165168

0 commit comments

Comments
 (0)