Ralph Schaer wrote:

> Hello
>
> Short comment about the ConvertUtils.convert... Methods.
> All convert methods returns zero when the String is not a valid value.
>
> Isn't this very dangerous, because zero can be a reasonable value in an
> application?
>

I'm open to suggestion on alternatives.

The problem is that there is nothing in the range of most of the primitive types
(byte, char, int, long) that corresponds to a "null" value for an object
reference.  The only thing we can do is:
* Pick one particular value to be ambiguous ("did the user
  really type a zero or not?").
* Throw a conversion exception, which just throws the
  same decision back up a level.

>
> Ralph

Craig


Reply via email to