db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: JIRA JDO-104
Date Thu, 28 Jul 2005 17:24:54 GMT
Hi,

Looks right.

Craig

On Jul 28, 2005, at 10:19 AM, Michelle Caisse wrote:

> Hi,
>
> I've attached a patch for this issue for your review.  It replaces  
> all occurences of  Double.MAX_VALUE, Double.MIN_VALUE,  
> Float.MAX_VALUE, and Float.MIN_VALUE with AllTypes.DOUBLE_LARGEST,  
> AllTypes.DOUBLE_SMALLEST, AllTypes.FLOAT_LARGEST,  
> AllTypes.FLOAT_SMALLEST, respectively.
>
> -- Michelle
>
> Craig Russell wrote:
>> Hi Andy,
>>
>> On Jul 27, 2005, at 11:07 AM, Andy Jefferson wrote:
>>
>>> In reference to the Collection/List/Set tests failing with errors  
>>> such as :-
>>>
>>> test 
>>> (org.apache.jdo.tck.models.fieldtypes.TestArrayListCollections) 
>>> javax.jdo.JDODataStoreException:
>>> ERROR 22003: The resulting value is outside the range for the  
>>> data type
>>> DOUBLE.
>>>
>>> The test is trying to use a Collection of doubles, and insert  
>>> Java values of
>>> Double.MAX_SIZE into a Derby DOUBLE column, which will always be  
>>> touch and go
>>> with rounding issues etc (and whether the RDBMS in question  
>>> complains when
>>> the value is just outside its range, which Derby does, but MySQL  
>>> doesn't).
>>>
>>> I look at the TestFieldsOfDouble and see that the largest value  
>>> used in that
>>> test for a Double is AllTypes.DOUBLE_LARGEST  =  9999999999999.9
>>> Should we not be using the same values (whatever they are) in the
>>> collection/list/set tests, so we have consistency ?
>>
>> Yes, this was an oversight. We intended that DOUBLE_LARGEST would  
>> be used instead of the Double.MAX_SIZE.
>>
>> If you have a patch I'd be happy to recommend the change.
>>
>> Craig
>>>
>>>
>>>
>>>
>>> -- 
>>> Andy
>>>
>>
>> Craig Russell
>> Architect, Sun Java Enterprise System http://java.sun.com/products/ 
>> jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>>
>
> Index: test/java/org/apache/jdo/tck/models/fieldtypes/ 
> FirstSetOfTestValuesForCollection.java
> ===================================================================
> --- test/java/org/apache/jdo/tck/models/fieldtypes/ 
> FirstSetOfTestValuesForCollection.java    (revision 225400)
> +++ test/java/org/apache/jdo/tck/models/fieldtypes/ 
> FirstSetOfTestValuesForCollection.java    (working copy)
> @@ -19,6 +19,7 @@
>  import java.util.*;
>  import java.math.*;
>
> +import org.apache.jdo.tck.pc.fieldtypes.AllTypes;
>  import org.apache.jdo.tck.pc.fieldtypes.SimpleClass;
>
>  public class FirstSetOfTestValuesForCollection extends Hashtable {
> @@ -97,19 +98,19 @@
>      put("Byte", byteVector);
>
>      Vector doubleVector = new Vector();
> -    doubleVector.add(0, new Double(Double.MIN_VALUE));
> -    doubleVector.add(1, new Double(Double.MAX_VALUE));
> -    doubleVector.add(2, new Double(Double.MAX_VALUE - 20000));
> -    doubleVector.add(3, new Double(Double.MAX_VALUE -  
> 454545.436664));
> -    doubleVector.add(4, new Double(Double.MAX_VALUE -  
> 2323235.76764677));
> +    doubleVector.add(0, new Double(AllTypes.DOUBLE_SMALLEST));
> +    doubleVector.add(1, new Double(AllTypes.DOUBLE_LARGEST));
> +    doubleVector.add(2, new Double(AllTypes.DOUBLE_LARGEST - 20000));
> +    doubleVector.add(3, new Double(AllTypes.DOUBLE_LARGEST -  
> 454545.436664));
> +    doubleVector.add(4, new Double(AllTypes.DOUBLE_LARGEST -  
> 2323235.76764677));
>      put("Double", doubleVector);
>
>      Vector floatVector = new Vector();
> -    floatVector.add(0, new Float(Float.MIN_VALUE));
> -    floatVector.add(1, new Float(Float.MAX_VALUE));
> -    floatVector.add(2, new Float(Float.MAX_VALUE - 20000));
> -    floatVector.add(3, new Float(Float.MAX_VALUE - 454545.434));
> -    floatVector.add(4, new Float(Float.MAX_VALUE - 565656.43434));
> +    floatVector.add(0, new Float(AllTypes.FLOAT_SMALLEST));
> +    floatVector.add(1, new Float(AllTypes.FLOAT_LARGEST));
> +    floatVector.add(2, new Float(AllTypes.FLOAT_LARGEST - 20000));
> +    floatVector.add(3, new Float(AllTypes.FLOAT_LARGEST -  
> 454545.434));
> +    floatVector.add(4, new Float(AllTypes.FLOAT_LARGEST -  
> 565656.43434));
>      put("Float", floatVector);
>
>      Vector integerVector = new Vector();
> Index: test/java/org/apache/jdo/tck/models/fieldtypes/ 
> SecondSetOfTestValuesForCollection.java
> ===================================================================
> --- test/java/org/apache/jdo/tck/models/fieldtypes/ 
> SecondSetOfTestValuesForCollection.java    (revision 225400)
> +++ test/java/org/apache/jdo/tck/models/fieldtypes/ 
> SecondSetOfTestValuesForCollection.java    (working copy)
> @@ -19,6 +19,7 @@
>  import java.util.*;
>  import java.math.*;
>
> +import org.apache.jdo.tck.pc.fieldtypes.AllTypes;
>  import org.apache.jdo.tck.pc.fieldtypes.SimpleClass;
>
>  public class SecondSetOfTestValuesForCollection extends Hashtable {
> @@ -98,19 +99,19 @@
>      put("Byte", byteVector);
>
>      Vector doubleVector = new Vector();
> -    doubleVector.add(0, new Double(Double.MAX_VALUE - 343434));
> -    doubleVector.add(1, new Double(Double.MIN_VALUE));
> -    doubleVector.add(2, new Double(Double.MAX_VALUE));
> -    doubleVector.add(3, new Double(Double.MAX_VALUE -  
> 65423445.436664));
> -    doubleVector.add(4, new Double(Double.MAX_VALUE -  
> 7235.236764677));
> +    doubleVector.add(0, new Double(AllTypes.DOUBLE_LARGEST -  
> 343434));
> +    doubleVector.add(1, new Double(AllTypes.DOUBLE_SMALLEST));
> +    doubleVector.add(2, new Double(AllTypes.DOUBLE_LARGEST));
> +    doubleVector.add(3, new Double(AllTypes.DOUBLE_LARGEST -  
> 65423445.436664));
> +    doubleVector.add(4, new Double(AllTypes.DOUBLE_LARGEST -  
> 7235.236764677));
>      put("Double", doubleVector);
>
>      Vector floatVector = new Vector();
> -    floatVector.add(0, new Float(Float.MAX_VALUE - 5452));
> -    floatVector.add(1, new Float(Float.MIN_VALUE));
> -    floatVector.add(2, new Float(Float.MAX_VALUE - 6564560.54));
> -    floatVector.add(3, new Float(Float.MAX_VALUE));
> -    floatVector.add(4, new Float(Float.MAX_VALUE - 9756.634));
> +    floatVector.add(0, new Float(AllTypes.FLOAT_LARGEST - 5452));
> +    floatVector.add(1, new Float(AllTypes.FLOAT_SMALLEST));
> +    floatVector.add(2, new Float(AllTypes.FLOAT_LARGEST -  
> 6564560.54));
> +    floatVector.add(3, new Float(AllTypes.FLOAT_LARGEST));
> +    floatVector.add(4, new Float(AllTypes.FLOAT_LARGEST - 9756.634));
>      put("Float", floatVector);
>
>      Vector integerVector = new Vector();
> Index: test/java/org/apache/jdo/tck/models/fieldtypes/ 
> TestFieldsOfFloat.java
> ===================================================================
> --- test/java/org/apache/jdo/tck/models/fieldtypes/ 
> TestFieldsOfFloat.java    (revision 225400)
> +++ test/java/org/apache/jdo/tck/models/fieldtypes/ 
> TestFieldsOfFloat.java    (working copy)
> @@ -20,6 +20,7 @@
>  import javax.jdo.Transaction;
>
>  import org.apache.jdo.tck.JDO_Test;
> +import org.apache.jdo.tck.pc.fieldtypes.AllTypes;
>  import org.apache.jdo.tck.pc.fieldtypes.FieldsOfFloat;
>  import org.apache.jdo.tck.util.BatchTestRunner;
>
> @@ -75,8 +76,8 @@
>          Transaction tx = pm.currentTransaction();
>          try {
>              int i, n;
> -            Float firstValue = new Float(Float.MIN_VALUE);
> -            Float secondValue = new Float(Float.MAX_VALUE);
> +            Float firstValue = new Float(AllTypes.FLOAT_SMALLEST);
> +            Float secondValue = new Float(AllTypes.FLOAT_LARGEST);
>              tx.begin();
>              FieldsOfFloat pi = new FieldsOfFloat();
>              pi.identifier = 1;
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message