Using jdk1.7.0_55, I get parseposition.errorIndex as 0 in the timezone case, is not standard.
But using jdk1.6.0_38, I get parseposition.errorIndex as 21 for the same wrong timezone format
The following is an example:
String date = "13 Jan 2005 21:45:34 ABC"; String format = "dd MMM yyyy HH:mm:ss z"; ParsePosition pp = new ParsePosition(0); pp.setIndex(0); SimpleDateFormat sd = new SimpleDateFormat(format,Locale.ENGLISH); Date d = sd.parse(date,pp); System.out.println("Error Index "+pp.getErrorIndex());
Result Using jdk 6:
Error Index 21
Result Using jdk 7
Error Index 0
Why is there a difference?
Please, help
source share