Re: bug in SFieldDouble

Franck Routier <[email protected]> Fri, 21 May 2010 15:44:15 +0200
Newsgroups gmane.comp.java.orm.simpleorm
Organization Axège sarl
Message-ID <1274449455.2405.18.camel@franck-laptop>
Thanks Noel,

I've just commited your fix.

Franck



Le vendredi 21 mai 2010 à 11:52 +0200, Noel Grandin a écrit :
>   
> Hi
> 
> Thanks for a great tool! Using it has been a pleasure.
> 
> There is a small bug in SFieldDouble which occurs when you pass a
> Float down the call chain
>   SRecordInstance#setObject(SFieldMeta field, Object value, boolean
> fieldValidate)
>   ->convertToDataSetFieldType(Object)
> 
>     protected Object convertToDataSetFieldType(Object raw) throws
> Exception {
>         if (raw instanceof Double)
>             return raw;
>         if (raw == null)
>             return null; // Follows JDBC
>         if (raw instanceof Number)
> >>            return new Double(((Number) raw).intValue());
>         if (raw instanceof String) {
>             return Double.parseDouble((String) raw);
>         }
>         throw new SException.Data("Cannot convert " + raw + " to
> Double.");
>     }
> 
> The line I have marked with >> should read
>             return new Double(((Number) raw).doubleValue());
> 
> 
> Regards, Noel Grandin
> 
> 
> 
> 
> 
> 
> ______________________________________________________________________
> Disclaimer: http://www.peralex.com/disclaimer.html
> 
> 
> 
> 
> 






------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/