Name: mf23781 Date: 08/03/98
Run the code below and you will see the following exception
thrown:
java.lang.StringIndexOutOfBoundsException: String index out of
range: 25
//Test Case DateTest.java
import java.text.*;
class DateTest
{
public static void main(String args[])
{
SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yy HH:mm:ss.SSS zzz");
try
{
dateFormatter.parse("12/31/97 12:00:00.000 GMT");
}
catch(Exception e)
{
System.out.println("Exception: " + e);
}
}
}
If you add a space after GMT then no exception is thrown!
This appears to be fixed in 1.2beta4 FCS, but ideally should be fixed in the 1.1.x line.
======================================================================
- duplicates
-
JDK-4134203 SimpleDateFormat.parse() exception with GMT time zone
-
- Closed
-