Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of fallback patterns to DateFormatter loses cause in Spring 5.3.5 #26804

Closed
1 task done
sbrannen opened this issue Apr 14, 2021 · 0 comments
Closed
1 task done
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Apr 14, 2021

Overview

This is a follow up to #26777.

The support for fallback patterns introduced in Spring Framework 5.3.5 also introduced a regression regarding the loss of the original ParseException in org.springframework.format.datetime.DateFormatter.parse(String, Locale).

Deliverables

  • Retain the original ParseException in DateFormatter.
@sbrannen sbrannen added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) labels Apr 14, 2021
@sbrannen sbrannen self-assigned this Apr 14, 2021
@sbrannen sbrannen added this to the 5.3.7 milestone Apr 14, 2021
sbrannen added a commit that referenced this issue Apr 18, 2021
Prior to this commit, two tests for exception handling regarding
@DateTimeFormat processing only passed on Java 8. This is due to the
fact that the toString() implementation for annotations changed in Java
9. Specifically, the representation for arrays changed from [] to {},
and strings are enclosed in double quotes beginning with Java 9.

This commit ensures that the affected @DateTimeFormat tests pass on
Java 9+, by making the assertions more lenient regarding toString()
output for annotations.

See gh-26777
See gh-26804
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
The support for fallback parsing patterns in @DateTimeFormat introduced
in spring-projectsgh-20292 introduced a regression in that the original cause of the
parsing exception was no longer retained.

spring-projectsgh-26777 addressed that regression for `java.time` support; whereas,
this commit addresses that regression for legacy Date types.

This commit ensures that the original ParseException is set as the
cause for any newly created ParseException, thereby retaining the
original exception as the root cause.

Closes spring-projectsgh-26804
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
Prior to this commit, two tests for exception handling regarding
@DateTimeFormat processing only passed on Java 8. This is due to the
fact that the toString() implementation for annotations changed in Java
9. Specifically, the representation for arrays changed from [] to {},
and strings are enclosed in double quotes beginning with Java 9.

This commit ensures that the affected @DateTimeFormat tests pass on
Java 9+, by making the assertions more lenient regarding toString()
output for annotations.

See spring-projectsgh-26777
See spring-projectsgh-26804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

1 participant