Skip to content

Commit b8fdf3b

Browse files
committedFeb 15, 2021
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.
1 parent 8a45a65 commit b8fdf3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

Diff for: ‎src/main/java/org/springframework/data/repository/query/ResultProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public <T> T processResult(@Nullable Object source, Converter<Object, Object> pr
143143

144144
ChainingConverter converter = ChainingConverter.of(type.getReturnedType(), preparingConverter).and(this.converter);
145145

146-
if (source instanceof Slice && method.isPageQuery() || method.isSliceQuery()) {
146+
if (source instanceof Slice && (method.isPageQuery() || method.isSliceQuery())) {
147147
return (T) ((Slice<?>) source).map(converter::convert);
148148
}
149149

0 commit comments

Comments
 (0)
Please sign in to comment.