Improve guards to avoid potential ClassCastException.

We now guard Slice conversion against potential ClassCastException using the proper condition grouping. Previously, the conversion could happen if the query is a slice query while the source was not a Slice.

Resolves #2296.
This commit is contained in:
Mark Paluch
2021-02-15 15:31:53 +01:00
parent ee004b0f10
commit 7480fcf18a

View File

@@ -143,7 +143,7 @@ public class ResultProcessor {
ChainingConverter converter = ChainingConverter.of(type.getReturnedType(), preparingConverter).and(this.converter);
if (source instanceof Slice && method.isPageQuery() || method.isSliceQuery()) {
if (source instanceof Slice && (method.isPageQuery() || method.isSliceQuery())) {
return (T) ((Slice<?>) source).map(converter::convert);
}