-
Bug
-
Resolution: Fixed
-
P3
-
1.1
-
1.1.4
-
generic
-
generic
-
Not verified
The following program should throw ParseException instead of StringIndexOutOfBoundsException.
import java.text.*;
import java.util.*;
public class selm{
public static void main(String[] args){
SimpleDateFormat dateFormat;
Date date2;
dateFormat = new SimpleDateFormat("yy/mm/dd HH:mm:ss");
try{
date2 = dateFormat.parse("97/01/17");
System.out.println(date2.toString());
}
catch(ParseException e){
e.printStackTrace();
}
}
}
java selm
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(String.java)
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java)
at java.text.DateFormat.parse(DateFormat.java)
at selm.main(selm.java:10)
import java.text.*;
import java.util.*;
public class selm{
public static void main(String[] args){
SimpleDateFormat dateFormat;
Date date2;
dateFormat = new SimpleDateFormat("yy/mm/dd HH:mm:ss");
try{
date2 = dateFormat.parse("97/01/17");
System.out.println(date2.toString());
}
catch(ParseException e){
e.printStackTrace();
}
}
}
java selm
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(String.java)
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java)
at java.text.DateFormat.parse(DateFormat.java)
at selm.main(selm.java:10)