Author: jleroux
Date: Fri May 6 08:23:43 2011 New Revision: 1100130 URL: http://svn.apache.org/viewvc?rev=1100130&view=rev Log: Fixes some forgotten formatting issues in previous commit (r1100127). Due to tabs in patch. <<A patch from Philippe Mouawad "ResourceBundleMapWrapper memory usage improvement" https://issues.apache.org/jira/browse/OFBIZ-4268 Patch that creates the Map only when it is required>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java?rev=1100130&r1=1100129&r2=1100130&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java Fri May 6 08:23:43 2011 @@ -154,7 +154,7 @@ public class ResourceBundleMapWrapper im protected ResourceBundle resourceBundle; protected Map<String, Object> topLevelMap; private boolean isMapInitialized = false; - + public InternalRbmWrapper(ResourceBundle resourceBundle) { if (resourceBundle == null) { throw new IllegalArgumentException("Cannot create InternalRbmWrapper with a null ResourceBundle."); @@ -247,14 +247,14 @@ public class ResourceBundleMapWrapper im * @see java.util.Map#get(java.lang.Object) */ public Object get(Object arg0) { - Object value = null; - if(isMapInitialized) - { - value = this.topLevelMap.get(arg0); - } - - if (resourceBundle != null) { - if (value == null) { + Object value = null; + if(isMapInitialized) + { + value = this.topLevelMap.get(arg0); + } + + if (resourceBundle != null) { + if (value == null) { try { value = this.resourceBundle.getObject((String) arg0); } catch (MissingResourceException mre) { @@ -273,7 +273,7 @@ public class ResourceBundleMapWrapper im if (value == null) { value = arg0; } - */ + */ return value; } @@ -309,7 +309,7 @@ public class ResourceBundleMapWrapper im * @see java.util.Map#keySet() */ public Set<String> keySet() { - createMapWhenNeeded(); + createMapWhenNeeded(); return this.topLevelMap.keySet(); } @@ -317,7 +317,7 @@ public class ResourceBundleMapWrapper im * @see java.util.Map#values() */ public Collection<Object> values() { - createMapWhenNeeded(); + createMapWhenNeeded(); return this.topLevelMap.values(); } @@ -325,7 +325,7 @@ public class ResourceBundleMapWrapper im * @see java.util.Map#entrySet() */ public Set<Map.Entry<String, Object>> entrySet() { - createMapWhenNeeded(); + createMapWhenNeeded(); return this.topLevelMap.entrySet(); } |
Free forum by Nabble | Edit this page |