Ryan Lubke said the following on 5/17/07 8:10 PM PT:
> Matthias Wessendorf wrote:
>> Hi,
>>
>> I pass in a Number (Integer) to a converter, let's say DoubleConverter
>> and I get a classcastexception.
>>
>> the RI does:
>> try {
>> return (Float.toString(((Float) value).floatValue()));
>> }
> The above looks wrong.
>
> The RI, in the case of the DoubleConverter does:
>
> return (Double.toString(((Double) value).doubleValue()));
>
>
> It seems reasonable to me to expect the Object to be Double as that
> is what this converter deals with.
Code is always better off casting to Number in this
case. There's no advantage to using Double here,
other than more ClassCastExceptions.
-- Adam
>
>> MyFaces does:
>> try
>> {
>> return Double.toString(((Number)value).doubleValue());
>> }
>>
>> Shouldn't the RI use Number as well ?
>>
>> -Matthias
>>
>> http://fisheye5.cenqua.com/browse/~raw,r=1.21/javaserverfaces-sources/jsf-api/src/javax/faces/convert/DoubleConverter.java
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>