click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r927015 - /click/trunk/click/framework/src/org/apache/click/util/MessagesMap.java
Date Wed, 24 Mar 2010 11:30:15 GMT
Author: sabob
Date: Wed Mar 24 11:30:14 2010
New Revision: 927015

URL: http://svn.apache.org/viewvc?rev=927015&view=rev
Log:
small optimization by removing redundant containsKey lookup

Modified:
    click/trunk/click/framework/src/org/apache/click/util/MessagesMap.java

Modified: click/trunk/click/framework/src/org/apache/click/util/MessagesMap.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/MessagesMap.java?rev=927015&r1=927014&r2=927015&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/MessagesMap.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/MessagesMap.java Wed Mar 24 11:30:14
2010
@@ -160,10 +160,13 @@ public class MessagesMap implements Map<
      * @throws MissingResourceException if the given key was not found
      */
     public String get(Object key) {
-        if (containsKey(key)) {
-            return (String) messages.get(key);
+        String value = null;
+        if (key != null) {
+            ensureInitialized();
+            value = (String) messages.get(key);
+        }
 
-        } else {
+        if (value == null) {
             String msg =
                 "Message \"{0}\" not found in bundle \"{1}\" "
                 + "for locale \"{2}\"";
@@ -172,6 +175,7 @@ public class MessagesMap implements Map<
             msg = MessageFormat.format(msg, args);
             throw new MissingResourceException(msg, baseClass.getName(), keyStr);
         }
+        return value;
     }
 
     /**



Mime
View raw message