Andrew Haley wrote:
[EMAIL PROTECTED] wrote:
And here's the patch :)
[EMAIL PROTECTED] wrote:
The following change:
2007-07-03 Tania Bento <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
* java/lang/Integer.java:
(parseInt(String,int,boolean)): Throw NumberFormatException if
String is just "+".
Introduced a regression if String is "+X" where X is any number (mauve
test gnu.testlet.java.lang.Integer.parseInt). The following patch
changes parseInt to have the correct behavior. Can someone commit it?
But it's wrong. According to the doc, "The characters in the string
must all be decimal digits, except that the first character may be
an ASCII minus sign '-' ('\u002D') to indicate a negative value"
Yes, but it may not be a '+'. With the current implementation,
parseInt("+32") gives -32. It should throw a NumberFormatException
(which is what the patch does).
Nicolas
Andrew.