fix: 390-handling-property-reference-exception#589
Open
cholakov11 wants to merge 3 commits into
Open
Conversation
added 3 commits
September 13, 2024 16:09
…ption handling, edited changelog
|
Contributor
|
@cholakov11 can we close this PR in favor of #606 ? |
pwannenmacher
requested changes
Jul 21, 2025
pwannenmacher
left a comment
Member
There was a problem hiding this comment.
CHANGELOG.md conflicts with main. Some unwanted changes seem to have occurred there (probably due to automatic formatting). Please rebase and remove all unwanted changes to CHANGELOG.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Implemented an exception handler to handle PropertyReferenceException caused by an invalid value in the
sortquery parameter. Previous behaviour resulted in anInternal Error 500response with a full trace of the exception. Now the API will respond with the error format used for reporting other errors (e.g Unauthorized) and omits the exception trace thus resulting in a more clear and user-friendly response.Note: Invalid values for the other query parameters - page and size, are handled with an OK response from the server and a json containing results for the request with the invalid values substituted by default valid. In order to keep the invalid query handling consistent, the initial idea was to filter the
sortparameter for invalid values and in case of such present to return an unsorted response.This could be achieved with reflection and matching
sortparameter with defined fields of the java object. However since the Pageable interface is used to transmit the query parameters, the Pageable object annot be edited in a pre-processing function to remove invalid sort values and pass a new Pageable with only valid values and thus avoid the PropertyReferenceException. The only option is to construct aSimplePageRequestwhich implementsPageablewith the edited sort values and pass it on. This however breaks the Dependency Inversion principle and should be avoided.Therefore, at this point no solution will be implemented to handles the sort parameter like the other two and we will resolve to an ExceptionHandler.
fixes #390