db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r219688 - in /incubator/jdo/trunk: api20/src/java/javax/jdo/spi/I18NHelper.java core20/src/java/org/apache/jdo/util/I18NHelper.java ri11/src/java/org/apache/jdo/util/I18NHelper.java
Date Tue, 19 Jul 2005 14:00:31 GMT
Author: mbo
Date: Tue Jul 19 07:00:27 2005
New Revision: 219688

URL: http://svn.apache.org/viewcvs?rev=219688&view=rev
Log:
Added NOI18N comments and added method to get the underlying ResourceBundle from I18NHelper
(api20)

Modified:
    incubator/jdo/trunk/api20/src/java/javax/jdo/spi/I18NHelper.java
    incubator/jdo/trunk/core20/src/java/org/apache/jdo/util/I18NHelper.java
    incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java

Modified: incubator/jdo/trunk/api20/src/java/javax/jdo/spi/I18NHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/spi/I18NHelper.java?rev=219688&r1=219687&r2=219688&view=diff
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/spi/I18NHelper.java (original)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/spi/I18NHelper.java Tue Jul 19 07:00:27 2005
@@ -14,11 +14,6 @@
  * limitations under the License.
  */
 
-/*
- * I18NHelper.java
- *
- */
-
 package javax.jdo.spi;
 
 import java.util.*;
@@ -46,7 +41,7 @@
  * <P>
  * <code>throw new JDOFatalInternalException (msg.msg("ERR_NoMetadata", cls.getName()));</code>
  * @since 1.0.1
- * @version 1.0.2
+ * @version 1.1
  */        
 public class I18NHelper {
 
@@ -61,7 +56,11 @@
     /** The default locale for this VM.
      */
     private static Locale       locale = Locale.getDefault();
-    
+
+    /** The name of the bundle used by this instance of the helper.
+     */
+    private final String        bundleName;
+
     /** The bundle used by this instance of the helper.
      */
     private ResourceBundle      bundle = null;
@@ -75,6 +74,7 @@
 
     /** Constructor */
     private I18NHelper() {
+        this.bundleName = null;
     }
 
     /** Constructor for an instance bound to a bundle.
@@ -83,6 +83,7 @@
      * bundle
      */
     private I18NHelper (String bundleName, ClassLoader loader) {
+        this.bundleName = bundleName;
         try {
             bundle = loadBundle (bundleName, loader);
         }
@@ -212,6 +213,15 @@
         return getMessage(bundle, messageKey, arg);
     }
     
+    /** Returns the resource bundle used by this I18NHelper.
+     * @return the associated resource bundle
+     * @since 1.1
+     */
+    public ResourceBundle getResourceBundle () {
+        assertBundle ();
+        return bundle;
+    }
+    
     //========= Internal helper methods ==========
 
     /**
@@ -232,6 +242,18 @@
         return messages;
     }
 
+    /** Assert resources available
+     * @since 1.1
+     * @throws JDOFatalInternalException if the resource bundle could not
+     * be loaded during construction.
+     */
+    private void assertBundle () {
+        if (failure != null)
+            throw new JDOFatalInternalException (
+                "No resources could be found for bundle:\"" + 
+                bundle + "\" ", failure);
+    }
+    
     /** Assert resources available
      * @param key the message key 
      * @since 1.0.2

Modified: incubator/jdo/trunk/core20/src/java/org/apache/jdo/util/I18NHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/util/I18NHelper.java?rev=219688&r1=219687&r2=219688&view=diff
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/util/I18NHelper.java (original)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/util/I18NHelper.java Tue Jul 19 07:00:27
2005
@@ -248,8 +248,8 @@
     private void assertBundle () {
         if (failure != null)
             throw new RuntimeException (
-                "No resources could be found for bundle:\"" + 
-                bundle + "\" " + failure);
+                "No resources could be found for bundle:\"" + //NOI18N
+                bundle + "\" " + failure); //NOI18N
     }
     
     /** Assert resources available
@@ -261,8 +261,8 @@
     private void assertBundle (String key) {
         if (failure != null)
             throw new RuntimeException (
-                "No resources could be found to annotate error message key:\"" + 
-                key + "\" " + failure);
+                "No resources could be found to annotate error message key:\"" + //NOI18N
+                key + "\" " + failure); //NOI18N
     }
 
     /**

Modified: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java?rev=219688&r1=219687&r2=219688&view=diff
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java (original)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/util/I18NHelper.java Tue Jul 19 07:00:27
2005
@@ -248,8 +248,8 @@
     private void assertBundle () {
         if (failure != null)
             throw new RuntimeException (
-                "No resources could be found for bundle:\"" + 
-                bundle + "\" " + failure);
+                "No resources could be found for bundle:\"" + //NOI18N
+                bundle + "\" " + failure); //NOI18N
     }
     
     /** Assert resources available
@@ -261,8 +261,8 @@
     private void assertBundle (String key) {
         if (failure != null)
             throw new RuntimeException (
-                "No resources could be found to annotate error message key:\"" + 
-                key + "\" " + failure);
+                "No resources could be found to annotate error message key:\"" + //NOI18N
+                key + "\" " + failure); //NOI18N
     }
 
     /**



Mime
View raw message