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

Classification of ClassCastExceptions doesn't work in JDK 11 (OpenJDK) [SPR-17093] #21630

Closed
spring-issuemaster opened this issue Jul 26, 2018 · 2 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 26, 2018

Jens Schauder opened SPR-17093 and commented

SimpleApplicationEventMulticaster.matchesClassCastMessage fails to match cases it should match in JDK 11.

The reason seems to be that instead of starting with the class name or module/class name the message now starts with "class " followed by the class name, which (I think) is the result of the Class.toString() method.

I came across this due to a failing build with Spring Data JDBC examples (https://travis-ci.org/spring-projects/spring-data-examples/jobs/407985295)


Affects: 4.3.18, 5.0.7, 5.1 RC1

Issue Links:

  • #20981 Lambda error detection might not work on JDK 9
  • #19412 SimpleApplicationEventMulticaster should not generally suppress ClassCastException
  • #19711 SimpleApplicationEventMulticaster should not rely on ClassCastException having a message
  • #20937 Compatibility with JDK 11

Referenced from: commits spring-projects/spring-data-examples@f31c83a

Backported to: 4.3.19

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 26, 2018

Juergen Hoeller commented

So they changed the ClassCastException message twice in a year... and still don't bother exposing the affected Class reference :-(

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 26, 2018

Juergen Hoeller commented

I've added a starts-with check for the full Class.toString() representation... backporting this to 5.0.9 and 4.3.19 for JDK 11 runtime compatibility there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.