changeset 3320:f2ce02ef81e9

8153417: jshell tool: use test passed locale to retrieve ResourceBundle Reviewed-by: jlahoda
author rfield
date Mon, 04 Apr 2016 20:28:05 -0700
parents 83c0f2cb6028
children 68696e640592
files src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Mon Apr 04 12:34:42 2016 -0700
+++ b/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)";
             }