db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From be...@apache.org
Subject svn commit: r388161 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/CrossConverters.java engine/org/apache/derby/iapi/types/SQLDouble.java
Date Thu, 23 Mar 2006 12:51:47 GMT
Author: bernt
Date: Thu Mar 23 04:51:45 2006
New Revision: 388161

URL: http://svn.apache.org/viewcvs?rev=388161&view=rev
Log:
DERBY-1136 JDBC driver on rs.getFloat() gives LossOfPrecisionConversionException for float
fields containing Float.MAX_VALUE

Submitted by HÃ¥vard Mork


Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java?rev=388161&r1=388160&r2=388161&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java Thu Mar
23 04:51:45 2006
@@ -1074,7 +1074,7 @@
 
     final float getFloatFromDouble(double source) throws SqlException {
         if (Configuration.rangeCheckCrossConverters &&
-                (source > Float.MAX_VALUE || source < -Float.MAX_VALUE)) {
+                Float.isInfinite((float)source)) {
             throw new LossOfPrecisionConversionException(agent_.logWriter_, String.valueOf(source));
         }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java?rev=388161&r1=388160&r2=388161&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java Thu Mar 23
04:51:45 2006
@@ -134,7 +134,7 @@
 	 */
 	public float	getFloat() throws StandardException
 	{
-		if (Math.abs(value) > Float.MAX_VALUE)
+		if (Float.isInfinite((float)value))
 			throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.REAL_NAME);
 		return (float) value;
 	}



Mime
View raw message