8310201: Reduce verbose locale output in -XshowSettings launcher option

Reviewed-by: jpai
This commit is contained in:
Sean Coffey 2023-07-17 08:28:16 +00:00
parent a4412166ec
commit f6e23ae451
2 changed files with 22 additions and 7 deletions

View file

@ -170,7 +170,7 @@ public final class LauncherHelper {
printProperties(); printProperties();
break; break;
case "locale": case "locale":
printLocale(); printLocale(false);
break; break;
case "security": case "security":
var opt = opts.length > 2 ? opts[2].trim() : "all"; var opt = opts.length > 2 ? opts[2].trim() : "all";
@ -184,7 +184,7 @@ public final class LauncherHelper {
default: default:
printVmSettings(initialHeapSize, maxHeapSize, stackSize); printVmSettings(initialHeapSize, maxHeapSize, stackSize);
printProperties(); printProperties();
printLocale(); printLocale(true);
SecuritySettings.printSecuritySummarySettings(ostream); SecuritySettings.printSecuritySummarySettings(ostream);
if (OperatingSystem.isLinux()) { if (OperatingSystem.isLinux()) {
printSystemMetrics(); printSystemMetrics();
@ -280,9 +280,15 @@ public final class LauncherHelper {
/* /*
* prints the locale subopt/section * prints the locale subopt/section
*/ */
private static void printLocale() { private static void printLocale(boolean summaryMode) {
Locale locale = Locale.getDefault(); Locale locale = Locale.getDefault();
ostream.println(LOCALE_SETTINGS); if (!summaryMode) {
ostream.println(LOCALE_SETTINGS);
} else {
ostream.println("Locale settings summary:");
ostream.println(INDENT + "Use \"-XshowSettings:locale\" " +
"option for verbose locale settings options");
}
ostream.println(INDENT + "default locale = " + ostream.println(INDENT + "default locale = " +
locale.getDisplayName()); locale.getDisplayName());
ostream.println(INDENT + "default display locale = " + ostream.println(INDENT + "default display locale = " +
@ -291,7 +297,9 @@ public final class LauncherHelper {
Locale.getDefault(Category.FORMAT).getDisplayName()); Locale.getDefault(Category.FORMAT).getDisplayName());
ostream.println(INDENT + "tzdata version = " + ostream.println(INDENT + "tzdata version = " +
ZoneInfoFile.getVersion()); ZoneInfoFile.getVersion());
printLocales(); if (!summaryMode) {
printLocales();
}
ostream.println(); ostream.println();
} }

View file

@ -25,7 +25,7 @@ import java.io.IOException;
/* /*
* @test * @test
* @bug 6994753 7123582 8305950 8281658 * @bug 6994753 7123582 8305950 8281658 8310201
* @summary tests -XshowSettings options * @summary tests -XshowSettings options
* @modules jdk.compiler * @modules jdk.compiler
* jdk.zipfs * jdk.zipfs
@ -67,6 +67,9 @@ public class Settings extends TestHelper {
private static final String VM_SETTINGS = "VM settings:"; private static final String VM_SETTINGS = "VM settings:";
private static final String PROP_SETTINGS = "Property settings:"; private static final String PROP_SETTINGS = "Property settings:";
private static final String LOCALE_SETTINGS = "Locale settings:"; private static final String LOCALE_SETTINGS = "Locale settings:";
private static final String LOCALE_SUMMARY_SETTINGS =
"Locale settings summary:";
private static final String AVAILABLE_LOCALES = "available locales";
private static final String SEC_PROPS_SETTINGS = "Security properties:"; private static final String SEC_PROPS_SETTINGS = "Security properties:";
private static final String SEC_SUMMARY_PROPS_SETTINGS = private static final String SEC_SUMMARY_PROPS_SETTINGS =
"Security settings summary:"; "Security settings summary:";
@ -81,7 +84,9 @@ public class Settings extends TestHelper {
static void containsAllOptions(TestResult tr) { static void containsAllOptions(TestResult tr) {
checkContains(tr, VM_SETTINGS); checkContains(tr, VM_SETTINGS);
checkContains(tr, PROP_SETTINGS); checkContains(tr, PROP_SETTINGS);
checkContains(tr, LOCALE_SETTINGS); checkNotContains(tr, LOCALE_SETTINGS);
checkNotContains(tr, AVAILABLE_LOCALES);
checkContains(tr, LOCALE_SUMMARY_SETTINGS);
// no verbose security settings unless "security" used // no verbose security settings unless "security" used
checkNotContains(tr, SEC_PROPS_SETTINGS); checkNotContains(tr, SEC_PROPS_SETTINGS);
checkContains(tr, SEC_SUMMARY_PROPS_SETTINGS); checkContains(tr, SEC_SUMMARY_PROPS_SETTINGS);
@ -153,6 +158,8 @@ public class Settings extends TestHelper {
checkNotContains(tr, VM_SETTINGS); checkNotContains(tr, VM_SETTINGS);
checkNotContains(tr, PROP_SETTINGS); checkNotContains(tr, PROP_SETTINGS);
checkContains(tr, LOCALE_SETTINGS); checkContains(tr, LOCALE_SETTINGS);
checkContains(tr, AVAILABLE_LOCALES);
checkNotContains(tr, LOCALE_SUMMARY_SETTINGS);
checkContains(tr, TZDATA_SETTINGS); checkContains(tr, TZDATA_SETTINGS);
} }