[cvs] expresso commit by lhamel: add getStringRequired which will throw

JCorporate Ltd jcorp at jcorp2.servlets.net
Fri Oct 15 20:28:35 PDT 2004


Log Message:
-----------
add getStringRequired which will throw

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/i18n:
        Messages.java

Revision Data
-------------
Index: Messages.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/i18n/Messages.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/i18n/Messages.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/i18n/Messages.java -u -r1.26 -r1.27
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/i18n/Messages.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/i18n/Messages.java
@@ -249,6 +249,20 @@
     } /* getString(String, String, String, String, Object[] */
 
     /**
+     * Return a string out of our message bundle associated with the specified schemaClass,
+     * throwing an exception if it's not found
+     *
+     * @param schemaClass the schema class
+     * @param stringCode  the string code
+     * @return java.lang.String
+     * @throws IllegalArgumentException if the given string code doesn't exist in the given bundle.
+     */
+    public static String getStringRequired(String schemaClass, String stringCode) {
+        MessageBundle mb = getBundleBySchema(schemaClass, Locale.getDefault());
+        return mb.getStringRequired(stringCode, null);
+    }
+
+    /**
      * Convenience method that gets a string using the schemaStack, looping
      * through it until the key is found
      *
@@ -287,7 +301,6 @@
      * @param stringCode  The string code to retrieve
      * @param args        the formatting arguments for the String
      * @return The properly formatted string as read from the messages bundle or the key if not found
-     * @throws IllegalArgumentException if the given string code doesn't exist in any schema in stack.
      */
     public static String getStringUnrequired(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args) throws IllegalArgumentException {
         String result = null;


More information about the cvs mailing list