# HG changeset patch # User rfield # Date 1459826885 25200 # Node ID ddebebe611a15f6a0acd62c0402f275d32935cdf # Parent 7f814aac1f805dc25279e506e7ea5f948e40eff9 8153417: jshell tool: use test passed locale to retrieve ResourceBundle Reviewed-by: jlahoda diff -r 7f814aac1f80 -r ddebebe611a1 langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Mon Apr 04 12:34:42 2016 -0700 +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Mon Apr 04 20:28:05 2016 -0700 @@ -118,9 +118,6 @@ private static final String RB_NAME_PREFIX = "jdk.internal.jshell.tool.resources"; private static final String VERSION_RB_NAME = RB_NAME_PREFIX + ".version"; private static final String L10N_RB_NAME = RB_NAME_PREFIX + ".l10n"; - private static ResourceBundle versionRB = null; - private static ResourceBundle outputRB = null; - final InputStream cmdin; final PrintStream cmdout; @@ -162,6 +159,9 @@ this.locale = locale; } + private ResourceBundle versionRB = null; + private ResourceBundle outputRB = null; + private IOContext input = null; private boolean regenerateOnDeath = true; private boolean live = false; @@ -282,9 +282,9 @@ String getResourceString(String key) { if (outputRB == null) { try { - outputRB = ResourceBundle.getBundle(L10N_RB_NAME); + outputRB = ResourceBundle.getBundle(L10N_RB_NAME, locale); } catch (MissingResourceException mre) { - error("Cannot find ResourceBundle: %s", L10N_RB_NAME); + error("Cannot find ResourceBundle: %s for locale: %s", L10N_RB_NAME, locale); return ""; } } @@ -2082,20 +2082,20 @@ /** The current version number as a string. */ - static String version() { + String version() { return version("release"); // mm.nn.oo[-milestone] } /** The current full version number as a string. */ - static String fullVersion() { + String fullVersion() { return version("full"); // mm.mm.oo[-milestone]-build } - private static String version(String key) { + private String version(String key) { if (versionRB == null) { try { - versionRB = ResourceBundle.getBundle(VERSION_RB_NAME); + versionRB = ResourceBundle.getBundle(VERSION_RB_NAME, locale); } catch (MissingResourceException e) { return "(version info not available)"; }