Skip to content

Throw UnsupportedOperationException when a projected value cannot be returned #2291

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

Closed
wants to merge 4 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Feb 2, 2021

We now throw UnsupportedOperationException when a projected value cannot be returned because it cannot be brought into the target type, either via conversion or projection.

This exception improves the error message by avoiding throwing IllegalArgumentException: Projection type must be an interface from the last branch that falls back into projections.

Closes #2290.


Could be backported into 2.3.x and 2.4.x branches.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 2, 2021
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 2, 2021
@mp911de mp911de requested a review from odrotbohm February 2, 2021 15:53
In oder to preserve contextual information the PersistentPropertyPathFactory now obtains EntityInformation for properties from the MappingContext via their PersistentProperty representation instead of plain the TypeInformation as the former contains more information about the actual type and signatures.
mp911de and others added 3 commits February 9, 2021 09:12
…returned.

We now throw UnsupportedOperationException when a projected value cannot be returned because it cannot be brought into the target type, either via conversion or projection.

This exception improves the error message by avoiding throwing IllegalArgumentException: Projection type must be an interface from the last branch that falls back into projections.

Closes #2290.
Do not include the result value in the exception message to avoid data exposure.
improve method order to avoid superfluous null checks.
christophstrobl pushed a commit that referenced this pull request Feb 9, 2021
…returned.

We now throw UnsupportedOperationException when a projected value cannot be returned because it cannot be brought into the target type, either via conversion or projection.

This exception improves the error message by avoiding throwing IllegalArgumentException: Projection type must be an interface from the last branch that falls back into projections.

Closes #2290.
Original Pull Request: #2291
christophstrobl added a commit that referenced this pull request Feb 9, 2021
Do not include the result value in the exception message to avoid data exposure.
Improve data flow to avoid superfluous null checks.

See #2290.
Original Pull Request: #2291.
@christophstrobl christophstrobl added this to the 2.5 M3 (2021.0.0) milestone Feb 9, 2021
@christophstrobl christophstrobl deleted the issue/2290 branch February 9, 2021 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interface projection with native query not working for boolean (mysql) [DATACMNS-1695]
3 participants