Browse Source

Polishing

Get rid of exception in positional parameter detection.
issue/4502
Christoph Strobl 2 years ago
parent
commit
1d13be8dc8
No known key found for this signature in database
GPG Key ID: 8CC1AB53391458C8
  1. 14
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

14
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

@ -1490,6 +1490,10 @@ public class QueryMapper { @@ -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 { @@ -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;
}
}
}

Loading…
Cancel
Save