summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2008-05-12 22:14:55 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2008-05-12 22:14:55 +0000
commit02921b01621bc91bc1c1b9729e33515fea757e59 (patch)
treec21cecb465cfa668a9af93030139aea7d0c7b05f /java
parente3e1dcdb5d0f824dff35d185ac94e87a7fb0660e (diff)
downloadclasspath-02921b01621bc91bc1c1b9729e33515fea757e59.tar.gz
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.
Diffstat (limited to 'java')
-rw-r--r--java/lang/Integer.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/java/lang/Integer.java b/java/lang/Integer.java
index 8f32869a3..8a5514a81 100644
--- a/java/lang/Integer.java
+++ b/java/lang/Integer.java
@@ -776,16 +776,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);
}
+ if (ch == '+')
+ {
+ if (len == 1)
+ throw new NumberFormatException("pure '+'");
+ ch = str.charAt(++index);
+ }
if (decode)
{
if (ch == '0')