[kaffe] Bug report: NumberFormatException in Float.valueOf

Laurent Martelli laurent at aopsys.com
Wed May 19 09:35:03 PDT 2004


java.lang.Float.valueOf (and also java.lang.Double.valueOf()) must not
use the locale to convert the string into a float or double. 

The javadoc says:

 Leading and trailing whitespace characters in s are ignored. The rest
 of s should constitute a FloatValue as described by the lexical
 syntax rules:


 FloatValue:
 
          Signopt FloatingPointLiteral
 

where Sign, FloatingPointLiteral are as defined in
§3.10.2 of the Java Language Specification.

And the Java Language Specification says (§3.10.2):

A floating-point literal has the following parts: a whole-number part,
a decimal point (represented by an ASCII period character), a
fractional part, an exponent, and a type suffix. The exponent, if
present, is indicated by the ASCII letter e or E followed by an
optionally signed integer.

Regards,
Laurent

-- 
Laurent Martelli
laurent at aopsys.com                                Java Aspect Components
http://www.aopsys.com/                          http://jac.objectweb.org





More information about the kaffe mailing list