diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java index 3718ac88f..1c4e4bb76 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java @@ -1490,6 +1490,10 @@ public class QueryMapper { static boolean isPositionalParameter(String partial) { + if(!StringUtils.hasText(partial)) { + return false; + } + if ("$".equals(partial)) { return true; } @@ -1499,12 +1503,12 @@ public class QueryMapper { return true; } - try { - Long.valueOf(partial); - return true; - } catch (NumberFormatException e) { - return false; + for (int i = 0; i < partial.length(); i++) { + if (!Character.isDigit(partial.charAt(i))) { + return false; + } } + return true; } } }