Skip to content

Commit 7480fcf

Browse files
committed
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 ee004b0 commit 7480fcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)