Should SimpleDateFormat with German Locale be able to parse a String with Timezone CEST?

208 Views Asked by At

I have a Java application which basically contains the following code in a test and expects it to throw an Exception:

String date = "Fr August 21 16:41:32 CEST 2015";
DateFormat dateFormat = new SimpleDateFormat("EEE MMMM dd HH:mm:ss z yyyy", Locale.GERMANY);
dateFormat.parse(date);

While the application ran under Suns Java 1.7 it always failed, as expected, with this Exception:

java.text.ParseException: Unparseable date: "Fr August 21 16:41:32 CEST 2015"

It failed because CEST wasn't a legit time zone with German Locale. When I now run the same test under IBMs Java 1.8, it now successfully parses to

Fr August 21 16:41:32 MESZ 2015

So I wonder which behaviour is the correct one? Do I now have a bug or did I have one before? Or did I somehow miss-configure something?

0

There are 0 best solutions below