Skip to content

Avoid re-wrapping query validation exceptions into IllegalArgumentException it they already are one #2736

Open
@odrotbohm

Description

@odrotbohm

History

In around 2012 we faced the problem of some persistence providers not producing the correct exceptions for calls to EntityManager.createQuery(…) (reported here). As a response, we added a rather broad catch clause to SimpleJpaQuery.validateQuery(…) that wraps any RuntimeException in an IllegalArgumentException.

Problem

If the original exception already is an IAE, and that seems to be the case as of today, we will just end up re-wrapping it without further benefit. This was brought up here, just recently.

Suggested solution

We could actually just throw the original exception to avoid the wrapping for this particular case.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions