ADDITIONAL SYSTEM INFORMATION :
java 11.0.20 2023-07-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.20+9-LTS-256)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.20+9-LTS-256, mixed mode)
A DESCRIPTION OF THE PROBLEM :
It seems that date parser is ignoring the locale provided so the code ends with an exception
REGRESSION : Last worked in version 8u381
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to parse to LocalDate the following string
"24ENE1982"
using
the locale
Locale("es", "ES")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1982-01-24
ACTUAL -
Exception in thread "main" java.time.format.DateTimeParseException: Text '24ENE1982' could not be parsed at index 2
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948)
at java.base/java.time.LocalDate.parse(LocalDate.java:428)
at Main.main(Main.java:7)
---------- BEGIN SOURCE ----------
import java.time.LocalDate;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Locale;
public class Main {
public static void main(String[] args) {
LocalDate date = LocalDate.parse("24ENE1982", new DateTimeFormatterBuilder().parseCaseInsensitive()
.appendPattern("ddMMMyyyy")
.toFormatter(new Locale("es", "ES")));
System.out.println(date);
}
}
---------- END SOURCE ----------
FREQUENCY : always
java 11.0.20 2023-07-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.20+9-LTS-256)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.20+9-LTS-256, mixed mode)
A DESCRIPTION OF THE PROBLEM :
It seems that date parser is ignoring the locale provided so the code ends with an exception
REGRESSION : Last worked in version 8u381
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to parse to LocalDate the following string
"24ENE1982"
using
the locale
Locale("es", "ES")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1982-01-24
ACTUAL -
Exception in thread "main" java.time.format.DateTimeParseException: Text '24ENE1982' could not be parsed at index 2
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948)
at java.base/java.time.LocalDate.parse(LocalDate.java:428)
at Main.main(Main.java:7)
---------- BEGIN SOURCE ----------
import java.time.LocalDate;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Locale;
public class Main {
public static void main(String[] args) {
LocalDate date = LocalDate.parse("24ENE1982", new DateTimeFormatterBuilder().parseCaseInsensitive()
.appendPattern("ddMMMyyyy")
.toFormatter(new Locale("es", "ES")));
System.out.println(date);
}
}
---------- END SOURCE ----------
FREQUENCY : always