In short, I’m trying to generalize LANG-1060, LANG-1040, LANG-1038, and
LANG-992 with a single issue that actually hits all the bases here with
NumberUtils.isNumber.
Bug (1):
System.out.println(lang.math.NumberUtils.isNumber(“+2”)); ----> false
while
System.out.println(lang.math.NumberUtils.createNumber(“+2)); ----> 2
Bug (2):
System.out.println(lang.math.NumberUtils.isNumber(“01.5”)); ----> false
while
System.out.println(lang.math.NumberUtils.createNumber(“01.5)); ---->
1.5.
It seems to me that we could externalize a considerable amount of the code
underlying the two methods into shared methods, as it seems like all the
validations in createNumber that predicate object creation should be directly
used in isNumber. I would love to hear folks’ thoughts.
Cheers,
-Rob