On 4/14/16 8:30 AM, Paul Sandoz wrote:
CachedRowSetImpl
—
1966 return ((Float.valueOf(value.toString())).floatValue());
Use Float.parseFloat ?
2010 return
((Double.valueOf(value.toString().trim())).doubleValue());
Use Double.parseDouble ?
I'm mostly reluctant to do general cleanups, as it can easily cause one to go
off into the weeds. However, I believe that changing
new Float(str).floatValue() or
Float.valueOf(str).floatValue() to Float.parseFloat(str)
and
new Double(str).doubleValue() or
Double.valueOf(str).doubleValue() to Double.parseDouble(str)
is generally safe. Essentially the string-arg versions of the constructors and
valueOf() methods just turn around and call parseFloat/Double internally and
store the primitive result in a field; and floatValue() and doubleValue() simply
get this field value.
This is in Lance's area; Lance, are you OK with this?
ExpressionExecuter
—
86 Double lval =
Double.valueOf(((Number)evaluate(l)).doubleValue());
87 Double rval =
Double.valueOf(((Number)evaluate(r)).doubleValue());
88 double result = op.eval(lval.doubleValue(),
rval.doubleValue());
89 if (debug) {
90 System.out.println("Performed Operation: " + lval + op +
rval
91 + " = " + result);
92 }
93 return Double.valueOf(result);
How about:
double lval = ((Number)evaluate(l)).doubleValue();
double rval = ((Number)evaluate(r)).doubleValue();
double result = op.eval(lval, rval);
Similar here.
Yes, I'll go ahead and make these changes.
s'marks