svn commit: r585653 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585653 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java

doogie-3
Author: doogie
Date: Wed Oct 17 12:56:32 2007
New Revision: 585653

URL: http://svn.apache.org/viewvc?rev=585653&view=rev
Log:
Creating a new Integer/Long, checking against null, then getting the
underlying value is an odd way to parse a string into a number.  It's
better to just call parseInt/parseLong.  Closes
https://issues.apache.org/jira/browse/OFBIZ-1300

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java?rev=585653&r1=585652&r2=585653&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java Wed Oct 17 12:56:32 2007
@@ -220,10 +220,7 @@
             try {
                 String value = getPropertyParam(res, propNames, "maxSize");
                 if (UtilValidate.isNotEmpty(value)) {
-                    Integer intValue = new Integer(value);
-                    if (intValue != null) {
-                        this.maxSize = intValue.intValue();
-                    }
+                    this.maxSize = Integer.parseInt(value);
                 }
             } catch (Exception e) {
                 Debug.logWarning(e, "Error getting maxSize value from cache.properties file for propNames: " + propNames, module);
@@ -231,10 +228,7 @@
             try {
                 String value = getPropertyParam(res, propNames, "maxInMemory");
                 if (UtilValidate.isNotEmpty(value)) {
-                    Integer intValue = new Integer(value);
-                    if (intValue != null) {
-                        this.maxInMemory = intValue.intValue();
-                    }
+                    this.maxInMemory = Integer.parseInt(value);
                 }
             } catch (Exception e) {
                 Debug.logWarning(e, "Error getting maxInMemory value from cache.properties file for propNames: " + propNames, module);
@@ -242,10 +236,7 @@
             try {
                 String value = getPropertyParam(res, propNames, "expireTime");
                 if (UtilValidate.isNotEmpty(value)) {
-                    Long longValue = new Long(value);
-                    if (longValue != null) {
-                        this.expireTime = longValue.longValue();
-                    }
+                    this.expireTime = Long.parseLong(value);
                 }
             } catch (Exception e) {
                 Debug.logWarning(e, "Error getting expireTime value from cache.properties file for propNames: " + propNames, module);