Skip to content

Conversation

vershnik
Copy link
Contributor

@vershnik vershnik commented Sep 9, 2024

… use the appropriate DateTimeFormatter for LocalDate

@reta
Copy link
Member

reta commented Sep 9, 2024

Thanks @vershnik , as you pointed out, this is very likely JDK related issue [1] that is not related to CXF (and impact all other applications out there).

[1] https://bugs.openjdk.org/browse/JDK-8294357

@vershnik
Copy link
Contributor Author

Even though it may turn out to be JDK issue, I think using DateTimeFormatter for parsing LocalDate is more appropriate and performance efficient (no need to create instances of SimpleDateFormat, Date, Instant, ZonedDateTime)

@reta
Copy link
Member

reta commented Sep 11, 2024

Even though it may turn out to be JDK issue, I think using DateTimeFormatter for parsing LocalDate is more appropriate and performance efficient (no need to create instances of SimpleDateFormat, Date, Instant, ZonedDateTime)

The DateTimeFormatter is certainly newer API than SimpleDateFormat but to my knowledge, DateTimeFormatter and SimpleDateFormat are not compatible [1], [2] (please correct me if I am wrong here). We could bring the changes than risk to break existing applications but those won't be backported.

To your point, it would make sense to migrate to java.time APIs but that should not be limited to LocalDate only (for example, the SearchUtils still use SimpleDateFormat).

[1] https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
[2] https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html

@vershnik
Copy link
Contributor Author

yes, looks like there is incompatibility between DateTimeFormatter and SimpleDateFormat
For example SimpleDateFormat for pattern 'yyyy-MM-dd' can parse even dates that contain time:
parse("2019-07-07 23:59:59")

while DateTimeFormatter is more strict here. So this change cannot be backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants