diff options
author | Adam King <aking@dreammechanics.com> | 2002-04-15 03:11:12 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2002-04-15 03:11:12 +0000 |
commit | ddfb5e0b6909fbd75ec04109eb6a70d42fddb5c1 (patch) | |
tree | ec2497cf8a67322b3c689962467ef766b234c381 /libjava | |
parent | bd6bec6be2be7b11880547fecd9df1c6fcb3fbdb (diff) | |
download | gcc-ddfb5e0b6909fbd75ec04109eb6a70d42fddb5c1.tar.gz |
natDouble.cc (parseDouble): Allow a number to end with the f/F/d/D modifiers.
2002-04-13 Adam King <aking@dreammechanics.com>
* java/lang/natDouble.cc (parseDouble): Allow a number to end with
the f/F/d/D modifiers.
From-SVN: r52308
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/lang/natDouble.cc | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4e8eb0336df..611da763eb6 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2002-04-13 Adam King <aking@dreammechanics.com> + + * java/lang/natDouble.cc (parseDouble): Allow a number to end with + the f/F/d/D modifiers. + 2002-04-12 Anthony Green <green@redhat.com> * Makefile.am (jardir, jar_DATA): Define (for libgcj.jar). diff --git a/libjava/java/lang/natDouble.cc b/libjava/java/lang/natDouble.cc index b0b24a7547c..329795d3e21 100644 --- a/libjava/java/lang/natDouble.cc +++ b/libjava/java/lang/natDouble.cc @@ -161,9 +161,19 @@ jdouble java::lang::Double::parseDouble(jstring str) { int length = str->length(); + while (length > 0 && Character::isWhitespace(str->charAt(length - 1))) length--; + + // The String could end with a f/F/d/D which is valid but we don't need. + if (length > 0) + { + jchar last = str->charAt(length-1); + if (last == 'f' || last == 'F' || last == 'd' || last == 'D') + length--; + } + jsize start = 0; while (length > 0 && Character::isWhitespace(str->charAt(start))) @@ -184,7 +194,7 @@ java::lang::Double::parseDouble(jstring str) if (endptr == data + blength) return val; } - throw new NumberFormatException; + throw new NumberFormatException(str); } void |