Author: adrianc
Date: Wed Aug 15 07:08:57 2012
New Revision: 1373239
URL:
http://svn.apache.org/viewvc?rev=1373239&view=revLog:
Partially reverting rev 1372738. As Scott pointed out on the dev mailing list, the conditions requiring a cast are rare - rendering those optimizations ineffective.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=1373239&r1=1373238&r2=1373239&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Wed Aug 15 07:08:57 2012
@@ -650,12 +650,8 @@ public class GenericEntity extends Obser
public Double getDouble(String name) {
// this "hack" is needed for now until the Double/BigDecimal issues are all resolved
Object value = get(name);
- if (value != null) {
- try {
- BigDecimal numValue = (BigDecimal) value;
- return new Double(numValue.doubleValue());
- } catch (ClassCastException e) {
- }
+ if (value instanceof BigDecimal) {
+ return new Double(((BigDecimal) value).doubleValue());
}
return (Double) value;
}
@@ -664,12 +660,8 @@ public class GenericEntity extends Obser
// this "hack" is needed for now until the Double/BigDecimal issues are all resolved
// NOTE: for things to generally work properly BigDecimal should really be used as the java-type in the field type def XML files
Object value = get(name);
- if (value != null) {
- try {
- Double numValue = (Double) value;
- return new BigDecimal(numValue.doubleValue());
- } catch (ClassCastException e) {
- }
+ if (value instanceof Double) {
+ return new BigDecimal(((Double) value).doubleValue());
}
return (BigDecimal) value;
}