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?

Thanks,
Nicolas

--- Integer.java	2008-05-03 19:01:55.000000000 +0200
+++ Integer.java	2008-05-03 19:02:53.000000000 +0200
@@ -776,13 +776,12 @@
     if (len == 0)
       throw new NumberFormatException("string length is null");
     int ch = str.charAt(index);
-    if (ch == '-' || ch == '+')
+    if (ch == '+')
+      throw new NumberFormatException("For input string " + str);
+    if (ch == '-')
       {
         if (len == 1)
-          if (ch == '-')
-            throw new NumberFormatException("pure '-'");
-          else if (ch == '+')
-            throw new NumberFormatException("pure '+'");
+          throw new NumberFormatException("pure '-'");
         isNeg = true;
         ch = str.charAt(++index);
       }

Reply via email to