diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-06-06 00:25:19 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-06-06 00:25:19 +0000 |
commit | 7cf521a28ef044f5bfb9c4a75b46085db6d420d2 (patch) | |
tree | 7c69e597711b3455ed9c91959c2583ece55c0b19 | |
parent | 070b8f7b02574cf5bb19ab6813092020ede391d7 (diff) | |
download | classpath-7cf521a28ef044f5bfb9c4a75b46085db6d420d2.tar.gz |
Backport Integer fix to 0.97.2
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | java/lang/Integer.java | 13 |
2 files changed, 20 insertions, 5 deletions
@@ -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') |