commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [lang] createInteger with leading 0's fails.
Date Mon, 10 Mar 2003 19:43:33 GMT
Hi all,

I added this testcase to

public void testCreateIntegerLeadingZero() {
        assertEquals("createInteger2(String) failed", new Integer("8"),

and I get the expected:
Testcase: testCreateInteger2 took 0 sec
	Caused an ERROR
java.lang.NumberFormatException: 8
	at java.lang.Integer.parseInt(
	at java.lang.Integer.valueOf(
	at java.lang.Integer.decode(

In my code, users sometimes enter 01 as meaning 1.  This means I have this
hokey StringUtils.strip(mystring,"0") before I hit the createInteger
function.  However, on thinking, is this a bug with the NumberUtils code?
If so, I volunteer to submit a patch for this.  Just looking for some
guidence before I make the changes.

Eric Pugh

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