Skip to content

Commit b99510b

Browse files
committed
DATAKV-185 - Adapt to changes in SpEL parser.
1 parent 9727c2c commit b99510b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
import org.springframework.data.repository.query.parser.PartTree.OrPart;
3030
import org.springframework.expression.spel.standard.SpelExpression;
3131
import org.springframework.expression.spel.standard.SpelExpressionParser;
32+
import org.springframework.util.StringUtils;
3233

3334
/**
3435
* {@link AbstractQueryCreator} to create {@link SpelExpression} based {@link KeyValueQuery}s.
3536
*
3637
* @author Christoph Strobl
3738
* @author Oliver Gierke
39+
* @author Mark Paluch
3840
*/
3941
public class SpelQueryCreator extends AbstractQueryCreator<KeyValueQuery<SpelExpression>, String> {
4042

@@ -109,7 +111,7 @@ protected SpelExpression toPredicateExpression(PartTree tree) {
109111

110112
Part part = partIter.next();
111113

112-
if(!requiresInverseLookup(part)) {
114+
if (!requiresInverseLookup(part)) {
113115

114116
partBuilder.append("#it?.");
115117
partBuilder.append(part.getProperty().toDotPath().replace(".", "?."));
@@ -212,7 +214,7 @@ protected SpelExpression toPredicateExpression(PartTree tree) {
212214
}
213215
}
214216

215-
return PARSER.parseRaw(sb.toString());
217+
return !StringUtils.hasText(sb) ? null : PARSER.parseRaw(sb.toString());
216218
}
217219

218220
private static boolean requiresInverseLookup(Part part) {

0 commit comments

Comments
 (0)