db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r772452 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/iapi/types/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 06 May 2009 22:35:49 GMT
Author: kahatlen
Date: Wed May  6 22:35:49 2009
New Revision: 772452

URL: http://svn.apache.org/viewvc?rev=772452&view=rev
Log:
DERBY-2447: ejbql and floattypes fail intermittently

Merged from trunk (revision 772449).

Added:
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/FloatTypesTest.java
      - copied unchanged from r772449, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/FloatTypesTest.java
Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/types/NumberDataType.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May  6 22:35:49 2009
@@ -1 +1 @@
-/db/derby/code/trunk:772090
+/db/derby/code/trunk:772090,772449

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/types/NumberDataType.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/types/NumberDataType.java?rev=772452&r1=772451&r2=772452&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/types/NumberDataType.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/types/NumberDataType.java
Wed May  6 22:35:49 2009
@@ -493,7 +493,10 @@
 			throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.REAL_NAME);
         }
         // Normalize negative floats to be "positive" (can't detect easily without using
Float object because -0.0f = 0.0f)
-        if (v == 0.0f) v = 0.0f;
+        // DERBY-2447: It shouldn't matter whether we compare to 0.0f or -0.0f,
+        // both should match negative zero, but comparing to 0.0f triggered
+        // this JVM bug: http://bugs.sun.com/view_bug.do?bug_id=6833879
+        if (v == -0.0f) v = 0.0f;
 
         return v;
 	}
@@ -519,7 +522,10 @@
 			throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.REAL_NAME);
         }
         // Normalize negative floats to be "positive" (can't detect easily without using
Float object because -0.0f = 0.0f)
-        if (v == 0.0d) v = 0.0d;
+        // DERBY-2447: It shouldn't matter whether we compare to 0.0d or -0.0d,
+        // both should match negative zero, but comparing to 0.0d triggered
+        // this JVM bug: http://bugs.sun.com/view_bug.do?bug_id=6833879
+        if (v == -0.0d) v = 0.0d;
 
         return (float)v;
     }
@@ -539,7 +545,10 @@
 			throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.DOUBLE_NAME);
         }
         // Normalize negative doubles to be "positive" (can't detect easily without using
Double object because -0.0f = 0.0f)
-        if (v == 0.0d) v = 0.0d;
+        // DERBY-2447: It shouldn't matter whether we compare to 0.0d or -0.0d,
+        // both should match negative zero, but comparing to 0.0d triggered
+        // this JVM bug: http://bugs.sun.com/view_bug.do?bug_id=6833879
+        if (v == -0.0d) v = 0.0d;
 
         return v;
 	}

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=772452&r1=772451&r2=772452&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Wed May  6 22:35:49 2009
@@ -65,6 +65,7 @@
         suite.addTest(DatabaseClassLoadingTest.suite());
         suite.addTest(DynamicLikeOptimizationTest.suite());
         suite.addTest(ExistsWithSubqueriesTest.suite());
+        suite.addTest(FloatTypesTest.suite());
         suite.addTest(GrantRevokeTest.suite());
         suite.addTest(GroupByExpressionTest.suite());
 		suite.addTest(LangScripts.suite());



Mime
View raw message