-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
9.0.4
-
x86_64
-
linux
FULL PRODUCT VERSION :
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux tichy 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Dates formatted with SimpleDateFormat under Java 8 can not be parsed back with Java 9 - the attached sources prove this to be the case with Locale GERMAN but i suspect it is valid for more than just this Locale
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the attached small app under java 8 and under Java 9 - under Java9 it will break. Reasons: different results when using the same format string. The Example shows differences at the name of the day of the week and at the month of the year representations - i suspect there is more...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java Version 1.8.0_144
SimpleDateFormat pattern; EEE, dd MMM yyyy H:m:s
Formatted Date: Di, 20 Mär 2018 8:54:4
Parsing Java-8-formatted-date: Di, 20 Mär 2018 8:49:8
ACTUAL -
Java Version 9.0.4
SimpleDateFormat pattern; EEE, dd MMM yyyy H:m:s
Formatted Date: Di., 20 März 2018 8:51:10
Parsing Java-8-formatted-date: Di, 20 Mär 2018 8:49:8
Exception in thread "main" java.text.ParseException: Unparseable date: "Di, 20 Mär 2018 8:49:8"
at java.base/java.text.DateFormat.parse(DateFormat.java:388)
at de.elbosso.scratch.misc.Java9DateFormatDEBug.main(Java9DateFormatDEBug.java:19)
Java Result: 1
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.text.ParseException: Unparseable date: "Di, 20 Mär 2018 8:49:8"
at java.base/java.text.DateFormat.parse(DateFormat.java:388)
at de.elbosso.scratch.misc.Java9DateFormatDEBug.main(Java9DateFormatDEBug.java:19)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.text.ParseException;
public class Java9DateFormatDEBug
{
public static void main(String[] args) throws IOException, ParseException
{
java.lang.String pattern="EEE, dd MMM yyyy H:m:s";
java.text.DateFormat rssf = new java.text.SimpleDateFormat(
pattern, java.util.Locale.GERMAN);
System.out.println("Java Version "+System.getProperty("java.version"));
System.out.println("SimpleDateFormat pattern; "+pattern);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(cal.MONTH, 2);
System.out.println("Formatted Date: "+rssf.format(cal.getTime()));
System.out.println("Parsing Java-8-formatted-date: Di, 20 Mär 2018 8:49:8");
rssf.parse("Di, 20 Mär 2018 8:49:8");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is none as far as i can see
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux tichy 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Dates formatted with SimpleDateFormat under Java 8 can not be parsed back with Java 9 - the attached sources prove this to be the case with Locale GERMAN but i suspect it is valid for more than just this Locale
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the attached small app under java 8 and under Java 9 - under Java9 it will break. Reasons: different results when using the same format string. The Example shows differences at the name of the day of the week and at the month of the year representations - i suspect there is more...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java Version 1.8.0_144
SimpleDateFormat pattern; EEE, dd MMM yyyy H:m:s
Formatted Date: Di, 20 Mär 2018 8:54:4
Parsing Java-8-formatted-date: Di, 20 Mär 2018 8:49:8
ACTUAL -
Java Version 9.0.4
SimpleDateFormat pattern; EEE, dd MMM yyyy H:m:s
Formatted Date: Di., 20 März 2018 8:51:10
Parsing Java-8-formatted-date: Di, 20 Mär 2018 8:49:8
Exception in thread "main" java.text.ParseException: Unparseable date: "Di, 20 Mär 2018 8:49:8"
at java.base/java.text.DateFormat.parse(DateFormat.java:388)
at de.elbosso.scratch.misc.Java9DateFormatDEBug.main(Java9DateFormatDEBug.java:19)
Java Result: 1
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.text.ParseException: Unparseable date: "Di, 20 Mär 2018 8:49:8"
at java.base/java.text.DateFormat.parse(DateFormat.java:388)
at de.elbosso.scratch.misc.Java9DateFormatDEBug.main(Java9DateFormatDEBug.java:19)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.text.ParseException;
public class Java9DateFormatDEBug
{
public static void main(String[] args) throws IOException, ParseException
{
java.lang.String pattern="EEE, dd MMM yyyy H:m:s";
java.text.DateFormat rssf = new java.text.SimpleDateFormat(
pattern, java.util.Locale.GERMAN);
System.out.println("Java Version "+System.getProperty("java.version"));
System.out.println("SimpleDateFormat pattern; "+pattern);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(cal.MONTH, 2);
System.out.println("Formatted Date: "+rssf.format(cal.getTime()));
System.out.println("Parsing Java-8-formatted-date: Di, 20 Mär 2018 8:49:8");
rssf.parse("Di, 20 Mär 2018 8:49:8");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is none as far as i can see