SUGGESTED FIX
See suggested fix for bug 4705734 for JavaDoc changes associated with this bug.
###@###.### 2002-07-08
Specification changed to match implementation; changes listed below
src/share/classes/java/lang/Float.java
=========================================
------- Float.java -------
146,152c146,156
< * <p>
< * If <code>s</code> is <code>null</code>, then a
< * <code>NullPointerException</code> is thrown.
< * <p>
< * Leading and trailing whitespace characters in <code>s</code>
< * are ignored. The rest of <code>s</code> should constitute a
< * <i>FloatValue</i> as described by the lexical syntax rules:
---
> *
> * <p>If <code>s</code> is <code>null</code>, then a
> * <code>NullPointerException</code> is thrown.
> *
> * <p>Leading and trailing whitespace characters in <code>s</code>
> * are ignored. Whitespace is removed as if by the {@link
> * String#trim} method; that is, both ASCII space and control
> * characters are removed. The rest of <code>s</code> should
> * constitute a <i>FloatValue</i> as described by the lexical
> * syntax rules:
> *
158a163
> * <dd>SignedInteger
161,163c166,170
< * where <i>Sign</i> and <i>FloatingPointLiteral</i> are as
< * defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#230798">§3.10.2</a>
< * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
---
> *
> * where <i>Sign</i>, <i>FloatingPointLiteral</i>, and
> * <i>SignedInteger</i> are as defined in <a
> * href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#230798">§3.10.2</a>
> * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
175,176c182,183
< * <p>
< * To interpret localized string representations of a
---
> *
> * <p>To interpret localized string representations of a
197a205,209
> * <p>To avoid calling this method on a invalid string and having
> * a <code>NumberFormatException</code> be thrown, the documentation
> * for {@link Double#valueOf Double.valueOf} lists a regular
> * expression which can be used to screen the input.
> *
src/share/classes/java/lang/Double.java
==========================================
------- Double.java -------
142,143c142,143
< * <p>
< * If <code>s</code> is <code>null</code>, then a
---
> *
> * <p>If <code>s</code> is <code>null</code>, then a
145,148c145,152
< * <p>
< * Leading and trailing whitespace characters in <code>s</code>
< * are ignored. The rest of <code>s</code> should constitute a
< * <i>FloatValue</i> as described by the lexical rule:
---
> *
> * <p>Leading and trailing whitespace characters in <code>s</code>
> * are ignored. Whitespace is removed as if by the {@link
> * String#trim} method; that is, both ASCII space and control
> * characters are removed. The rest of <code>s</code> should
> * constitute a <i>FloatValue</i> as described by the lexical
> * syntax rules:
> *
154a159
> * <dd>SignedInteger
157,158c162,164
< * where <i>Sign</i> and <i>FloatingPointLiteral</i> are as
< * defined in
---
> *
> * where <i>Sign</i>, <i>FloatingPointLiteral</i>, and
> * <i>SignedInteger</i> are as defined in
161,166c167,173
< * Language Specification</a>. If <code>s</code> does not have the
< * form of a <i>FloatValue</i>, then a <code>NumberFormatException</code>
< * is thrown. Otherwise, <code>s</code> is regarded as
< * representing an exact decimal value in the usual "computerized
< * scientific notation"; this exact decimal value is then
< * conceptually converted to an "infinitely precise" binary value
---
> * Language Specification</a>. If <code>s</code> does not have the
> * form of a <i>FloatValue</i>, then a
> * <code>NumberFormatException</code> is thrown. Otherwise,
> * <code>s</code> is regarded as representing an exact decimal
> * value in the usual "computerized scientific
> * notation"; this exact decimal value is then conceptually
> * converted to an "infinitely precise" binary value
171,173c178,180
< * <code>double</code> value is returned.
< * <p>
< * To interpret localized string representations of a
---
> * <code>double</code> value is returned.
> *
> * <p> To interpret localized string representations of a
194a202,244
> * <p>To avoid calling this method on a invalid string and having
> * a <code>NumberFormatException</code> be thrown, the regular
> * expression below can be used to screen the input string:
> *
> * <code>
> * <pre>
> * final String Digits = "(\\p{Digit}+)";
> * // an exponent is 'e' or 'E' followed by an optionally
> * // signed decimal integer.
> * final String Exp = "[eE][+-]?"+Digits;
> * final String fpRegex =
> * ("[\\x00-\\x20]*"+ // Optional leading "whitespace"
> * "[+-]?(" + // Optional sign character
> * "NaN|" + // "NaN" string
> * "Infinity|" + // "Infinity" string
> *
> * // A floating-point string representing a finite positive
> * // number without a leading sign has at most five basic pieces:
> * // Digits . Digits ExponentPart FloatTypeSuffix
> * //
> * // Since this method allows integer-only strings as input
> * // in addition to strings of floating-point literals, the
> * // two sub-patterns below are simplifications of the grammar
> * // productions from the Java Language Specification, 2nd
> * // edition, section 3.10.2.
> *
> * // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
> * "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
> *
> * // . Digits ExponentPart_opt FloatTypeSuffix_opt
> * "(\\.("+Digits+")("+Exp+")?))"+
> * "[fFdD]?))" +
> * "[\\x00-\\x20]*");// Optional trailing "whitespace"
> *
> * Pattern fpPattern = Pattern.compile(fpRegex);
> * if (fpPattern.match(myString))
> * Double.valueOf(myString); // Will not throw NumberFormatException
> * else {
> * // Perform suitable alternative action
> * }
> * </pre>
> * </code>
> *
###@###.### 2003-02-13
|