db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r598163 - in /db/derby/code/branches/10.3/java: testing/org/apache/derbyTesting/functionTests/tests/tools/ tools/org/apache/derby/iapi/tools/i18n/ tools/org/apache/derby/impl/tools/sysinfo/
Date Mon, 26 Nov 2007 08:33:09 GMT
Author: kahatlen
Date: Mon Nov 26 00:33:08 2007
New Revision: 598163

URL: http://svn.apache.org/viewvc?rev=598163&view=rev
Log:
DERBY-3142: sysinfo ignores derby.ui.locale

Merged fix from trunk (revision 597610).

Added:
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
      - copied unchanged from r597610, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
Modified:
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
    db/derby/code/branches/10.3/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
    db/derby/code/branches/10.3/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java?rev=598163&r1=598162&r2=598163&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
Mon Nov 26 00:33:08 2007
@@ -52,6 +52,7 @@
         suite.addTest(ImportExportProcedureTest.suite());
         suite.addTest(ToolScripts.suite());
         suite.addTest(SysinfoCPCheckTest.suite());
+        suite.addTest(SysinfoLocaleTest.suite());
 
         // SysinfoAPITest currently fails when run against jars, so is
         // disabled. Only the first jar file on the classpath properly

Modified: db/derby/code/branches/10.3/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java?rev=598163&r1=598162&r2=598163&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
(original)
+++ db/derby/code/branches/10.3/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
Mon Nov 26 00:33:08 2007
@@ -166,7 +166,7 @@
 			return;
 		}
 		if ( locale == null || locale.toString().equals("none") ){
-			res = ResourceBundle.getBundle(MESSAGE_FILE);
+			res = ResourceBundle.getBundle(messageFileName);
 		}
 		else
 		try {

Modified: db/derby/code/branches/10.3/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=598163&r1=598162&r2=598163&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/branches/10.3/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Mon
Nov 26 00:33:08 2007
@@ -86,6 +86,27 @@
 
 public final class Main {
 
+    /**
+     * Name of file which contains messages for sysinfo.
+     */
+    private final static String MESSAGE_FILE =
+        "org.apache.derby.loc.sysinfoMessages";
+
+    /**
+     * Resource for localizing the sysinfo messages.
+     *
+     * The default LocalizedResource reads messages from the toolsmessages
+     * bundle. Create this instance to read messages from sysinfoMessages. Use
+     * the locale and codeset specified by derby.ui.locale and derby.ui.codeset
+     * if they are set.
+     *
+     * Note that this variable must be initialized when the class is loaded in
+     * order to work correctly for the API methods that don't call
+     * <code>main()</code>.
+     */
+    private final static LocalizedResource LOCALIZED_RESOURCE =
+        new LocalizedResource(null, null, MESSAGE_FILE);
+
   /**
     Application entry point for SysInfo.   This will print out
     the Derby product information as well as a snapshot of
@@ -1086,16 +1107,9 @@
 	/*
 	** Message handling
 	*/
-	private static ResourceBundle getBundle() {
-		try {
-			return ResourceBundle.getBundle("org.apache.derby.loc.sysinfoMessages");
-		} catch (MissingResourceException mre) {
-		}
-		return null;
-	}
 
 	public static String getTextMessage(String msgId) {
-		return getCompleteMessage(msgId, (Object[]) null);
+		return getCompleteMessage(msgId, new Object[0]);
 	}
 	public static String getTextMessage(String msgId, Object a1) {
 
@@ -1114,9 +1128,7 @@
 	/**
 	 */
 	public static String getCompleteMessage(String msgId, Object[] arguments) {
-
-		// we have a base file (sysinfoMessages.properties) so don't give us a last chance.
-		return org.apache.derby.iapi.services.i18n.MessageService.formatMessage(getBundle(), msgId,
arguments, false);
+        return LOCALIZED_RESOURCE.getTextMessage(msgId, arguments);
 	}
 
     /**



Mime
View raw message