summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2008-06-06 00:25:19 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2008-06-06 00:25:19 +0000
commit7cf521a28ef044f5bfb9c4a75b46085db6d420d2 (patch)
tree7c69e597711b3455ed9c91959c2583ece55c0b19
parent070b8f7b02574cf5bb19ab6813092020ede391d7 (diff)
downloadclasspath-7cf521a28ef044f5bfb9c4a75b46085db6d420d2.tar.gz
Backport Integer fix to 0.97.2
-rw-r--r--ChangeLog12
-rw-r--r--java/lang/Integer.java13
2 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f9784167..27e8ae16c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-06-06 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/lang/Integer.java:
+ (parseInt(String, int, boolean)): Disallow "-+".
+
+2008-05-11 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ Reported by Nicolas Geoffray <nicolas.geoffray@menlina.com>
+ * java/lang/Integer.java:
+ (parseInt(String,int,boolean)): Parse +x
+ as x, not -x.
+
2008-06-05 Andrew John Hughes <gnu_andrew@member.fsf.org>
* configure.ac:
diff --git a/java/lang/Integer.java b/java/lang/Integer.java
index 62907ff77..cbf5274f0 100644
--- a/java/lang/Integer.java
+++ b/java/lang/Integer.java
@@ -705,16 +705,19 @@ public final class Integer extends Number implements Comparable<Integer>
if (len == 0)
throw new NumberFormatException("string length is null");
int ch = str.charAt(index);
- if (ch == '-' || ch == '+')
+ 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);
}
+ else if (ch == '+')
+ {
+ if (len == 1)
+ throw new NumberFormatException("pure '+'");
+ ch = str.charAt(++index);
+ }
if (decode)
{
if (ch == '0')