summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-15 03:11:12 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-15 03:11:12 +0000
commit64657b4bc2709f0f1d2e8291ec2aee9d4e4628fc (patch)
treeec2497cf8a67322b3c689962467ef766b234c381 /libjava/java/lang
parent06c7407ce2d0227b214b52799b5bd729448228b7 (diff)
downloadppe42-gcc-64657b4bc2709f0f1d2e8291ec2aee9d4e4628fc.tar.gz
ppe42-gcc-64657b4bc2709f0f1d2e8291ec2aee9d4e4628fc.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52308 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/natDouble.cc12
1 files changed, 11 insertions, 1 deletions
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
OpenPOWER on IntegriCloud