Обсуждение: ToBoolean method return correct Boolean values as per JDBC spec

Поиск
Список
Период
Сортировка

ToBoolean method return correct Boolean values as per JDBC spec

От
Kim Ho
Дата:
Problem:
- The toBoolean() method treats all input strings that start with T, t,
or 1 as true. For instance, "The sun is not a star." is evaluated as
true...
However, booleans are only supposed to be true if the
value of the input string is equalsignorecase "True".
I've left in a single character string "1" and
a single character string "t" (or "T") for backwards compatibility.

new Boolean("this is not a boolean") produces a Boolean object that
represents false.

However, when you insert 'this is not a boolean' into a CHAR column and
use getBoolean to extract it, it returns true.

Fix:
 - Different check in toBoolean()

Cheers,

Kim

Вложения