Name: rmT116609 Date: 11/19/2003
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows 2000 SP2
A DESCRIPTION OF THE PROBLEM :
Here is the sample code:
package code;
import java.text.NumberFormat;
import java.text.DecimalFormat;
class T
{
public static void main( String[] args ) {
try {
DecimalFormat df = (DecimalFormat)
NumberFormat.getInstance();
df.parse( "+123.45" );
}
catch( Throwable t ) {
t.printStackTrace();
}
}
}
Here is the output:
java.text.ParseException: Unparseable number: "+123.45"
at java.text.NumberFormat.parse(Unknown Source)
at code.T.main(T.java:11)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. compile the code javac code\T.java
2. Run the code java code.T
3. See the exception.
EXPECTED VERSUS ACTUAL BEHAVIOR :
It should parse this and give the number 123.45
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.text.ParseException: Unparseable number: "+123.45"
at java.text.NumberFormat.parse(Unknown Source)
at code.T.main(T.java:11)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package code;
import java.text.NumberFormat;
import java.text.DecimalFormat;
class T
{
public static void main( String[] args ) {
try {
DecimalFormat df = (DecimalFormat)NumberFormat.getInstance();
df.parse( "+123.45" );
}
catch( Throwable t ) {
t.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
None. Since the data can come from international users, not sure what character to remove from input string.
(Incident Review ID: 179185)
======================================================================