commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Tompkins <chtom...@gmail.com>
Subject [LANG] LANG-1252 - NumberUtils.isNumber and NumberUtils.createNumber resolve inconsistently
Date Thu, 28 Jul 2016 12:23:36 GMT
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




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message