From d51d9719660fa0f7d950fa09b8f491af8b048d93 Mon Sep 17 00:00:00 2001 From: yhuang Date: Wed, 11 Aug 2010 02:22:32 -0700 Subject: [PATCH] 6959252: convert the anonymous arrays to named arrays in Java List Resource files Reviewed-by: katakai, psun --- .../tools/example/debug/tty/TTYResources.java | 4 +- .../sun/applet/resources/MsgAppletViewer.java | 4 +- .../jconsole/resources/JConsoleResources.java | 55 ++++++++++--------- .../resources/MsgNative2ascii.java | 4 +- 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index 6998ed90b..2c5e12d5e 100644 --- a/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -45,7 +45,7 @@ public class TTYResources extends java.util.ListResourceBundle { * @return the contents of this ResourceBundle. */ public Object[][] getContents() { - return new Object[][] { + Object[][] temp = new Object[][] { // NOTE: The value strings in this file containing "{0}" are // processed by the java.text.MessageFormat class. Any // single quotes appearing in these strings need to be @@ -449,5 +449,7 @@ public class TTYResources extends java.util.ListResourceBundle { "For command help type ''help'' at {0} prompt"}, // END OF MATERIAL TO LOCALIZE }; + + return temp; } } diff --git a/src/share/classes/sun/applet/resources/MsgAppletViewer.java b/src/share/classes/sun/applet/resources/MsgAppletViewer.java index fcf66e64c..6c24c7f29 100644 --- a/src/share/classes/sun/applet/resources/MsgAppletViewer.java +++ b/src/share/classes/sun/applet/resources/MsgAppletViewer.java @@ -29,7 +29,7 @@ import java.util.ListResourceBundle; public class MsgAppletViewer extends ListResourceBundle { public Object[][] getContents() { - return new Object[][] { + Object[][] temp = new Object[][] { {"textframe.button.dismiss", "Dismiss"}, {"appletviewer.tool.title", "Applet Viewer: {0}"}, {"appletviewer.menu.applet", "Applet"}, @@ -197,5 +197,7 @@ public class MsgAppletViewer extends ListResourceBundle { {"appletsecurityexception.checkread.unknown", "unknown class loader type. unable to check for checking read {0}"}, {"appletsecurityexception.checkconnect.unknown", "unknown class loader type. unable to check for checking connect"}, }; + + return temp; } } diff --git a/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java b/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java index bce3f2ad7..c9e8ac07c 100644 --- a/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java +++ b/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java @@ -46,8 +46,6 @@ import static java.awt.event.KeyEvent.*; */ public class JConsoleResources extends ListResourceBundle { - private static final String cr = System.getProperty("line.separator"); - /** * Returns the contents of this ResourceBundle. * @@ -56,8 +54,8 @@ public class JConsoleResources extends ListResourceBundle { * @return the contents of this ResourceBundle. */ protected Object[][] getContents0() { - return new Object[][] { - // NOTE 1: The value strings in this file containing "{0}" are + Object[][] temp = new Object[][] { + // NOTE 1: The value strings in this file containing "{0}" are // processed by the java.text.MessageFormat class. Any // single quotes appearing in these strings need to be // doubled up. @@ -98,7 +96,7 @@ public class JConsoleResources extends ListResourceBundle { {"Attributes","Attributes"}, {"Blank", "Blank"}, {"BlockedCount WaitedCount", - "Total blocked: {0} Total waited: {1}" + cr}, + "Total blocked: {0} Total waited: {1}\n"}, {"Boot class path","Boot class path"}, {"BorderedComponent.moreOrLessButton.toolTip", "Toggle to show more or less information"}, {"CPU Usage","CPU Usage"}, @@ -271,21 +269,21 @@ public class JConsoleResources extends ListResourceBundle { {"Minimize All.mnemonic", 'M'}, {"Minus Version", "This is {0} version {1}"}, {"Monitor locked", - " - locked {0}" + cr}, + " - locked {0}\n"}, {"Motif","Motif"}, {"Name Build and Mode","{0} (build {1}, {2})"}, {"Name and Build","{0} (build {1})"}, {"Name","Name"}, {"Name: ","Name: "}, {"Name State", - "Name: {0}" + cr + - "State: {1}" + cr}, + "Name: {0}\n" + + "State: {1}\n"}, {"Name State LockName", - "Name: {0}" + cr + - "State: {1} on {2}" + cr}, + "Name: {0}\n" + + "State: {1} on {2}\n"}, {"Name State LockName LockOwner", - "Name: {0}" + cr + - "State: {1} on {2} owned by: {3}" + cr}, + "Name: {0}\n" + + "State: {1} on {2} owned by: {3}\n"}, {"New Connection...", "New Connection..."}, {"New Connection....mnemonic", 'N'}, {"New value applied","New value applied"}, @@ -351,7 +349,7 @@ public class JConsoleResources extends ListResourceBundle { {"Size Mb","{0} Mb"}, {"Source","Source"}, {"Stack trace", - cr + "Stack trace: " + cr}, + "\nStack trace: \n"}, {"Success:","Success:"}, // Note: SummaryTab.headerDateTimeFormat can be one the following: // 1. A combination of two styles for date and time, using the @@ -433,22 +431,27 @@ public class JConsoleResources extends ListResourceBundle { {"plot", "plot"}, {"visualize","visualize"}, {"zz usage text", - "Usage: {0} [ -interval=n ] [ -notile ] [ -pluginpath ] [ -version ] [ connection ... ]" + cr + - cr + - " -interval Set the update interval to n seconds (default is 4 seconds)" + cr + - " -notile Do not tile windows initially (for two or more connections)" + cr + - " -pluginpath Specify the path that jconsole uses to look up the plugins" + cr + - " -version Print program version" + cr + - cr + - " connection = pid || host:port || JMX URL (service:jmx:://...)" + cr + - " pid The process id of a target process" + cr + - " host A remote host name or IP address" + cr + - " port The port number for the remote connection" + cr + - cr + - " -J Specify the input arguments to the Java virtual machine" + cr + + "Usage: {0} [ -interval=n ] [ -notile ] [ -pluginpath ] [ -version ] [ connection ... ]\n\n" + + " -interval Set the update interval to n seconds (default is 4 seconds)\n" + + " -notile Do not tile windows initially (for two or more connections)\n" + + " -pluginpath Specify the path that jconsole uses to look up the plugins\n\n" + + " -version Print program version\n" + + " connection = pid || host:port || JMX URL (service:jmx:://...)\n" + + " pid The process id of a target process\n" + + " host A remote host name or IP address\n" + + " port The port number for the remote connection\n\n" + + " -J Specify the input arguments to the Java virtual machine\n" + " on which jconsole is running"}, // END OF MATERIAL TO LOCALIZE }; + + String ls = System.getProperty("line.separator"); + for(int i=0;i