dev@javaserverfaces.java.net

Re: [API] Converter(s).getAsString()

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Thu, 17 May 2007 20:10:25 -0700

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.

> 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
>
>