1
0
mirror of synced 2026-05-23 04:33:17 +00:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Spring Builds 9e85d0f27c Release version 4.3.9 (2021.1.9).
See #2331
2022-10-13 11:54:22 +00:00
Spring Builds 535cc84df5 Prepare 4.3.9 (2021.1.9).
See #2331
2022-10-13 11:51:47 +00:00
Spring Builds 3647fc6463 After release cleanups.
See #2297
2022-10-13 07:52:13 +00:00
Spring Builds bdb7ca03c6 Prepare next development iteration.
See #2297
2022-10-13 07:52:00 +00:00
Spring Builds 200a18b4b1 Release version 4.3.8 (2021.1.8).
See #2297
2022-10-13 07:28:26 +00:00
Spring Builds d0f7f79968 Prepare 4.3.8 (2021.1.8).
See #2297
2022-10-13 07:26:04 +00:00
Peter-Josef Meisch 027ff29436 Escape backslash in StringQuery.
Original Pull Request
Closes #2326

(cherry picked from commit 03ecc48b09)
(cherry picked from commit 2fa15f772a)
2022-10-11 22:49:30 +02:00
Spring Builds 69d80bd602 After release cleanups.
See #2220
2022-09-19 09:04:59 +00:00
Spring Builds f7a788ce2d Prepare next development iteration.
See #2220
2022-09-19 09:04:47 +00:00
4 changed files with 23 additions and 6 deletions
+3 -3
View File
@@ -5,12 +5,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.3.7</version>
<version>4.3.9</version>
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>2.6.7</version>
<version>2.6.9</version>
</parent>
<name>Spring Data Elasticsearch</name>
@@ -21,7 +21,7 @@
<elasticsearch>7.15.2</elasticsearch>
<log4j>2.17.0</log4j>
<netty>4.1.65.Final</netty>
<springdata.commons>2.6.7</springdata.commons>
<springdata.commons>2.6.9</springdata.commons>
<testcontainers>1.15.3</testcontainers>
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
<java-module-name>spring.data.elasticsearch</java-module-name>
@@ -46,7 +46,11 @@ final public class StringQueryUtil {
String placeholder = Pattern.quote(matcher.group()) + "(?!\\d+)";
int index = NumberUtils.parseNumber(matcher.group(1), Integer.class);
result = result.replaceAll(placeholder, Matcher.quoteReplacement(getParameterWithIndex(accessor, index)));
String replacement = Matcher.quoteReplacement(getParameterWithIndex(accessor, index));
result = result.replaceAll(placeholder, replacement);
// need to escape backslashes that are not escapes for quotes so that they are sent as double-backslashes
// to Elasticsearch
result = result.replaceAll("\\\\([^\"'])", "\\\\\\\\$1");
}
return result;
}
@@ -56,7 +60,6 @@ final public class StringQueryUtil {
Object parameter = accessor.getBindableValue(index);
String parameterValue = "null";
// noinspection ConstantConditions
if (parameter != null) {
parameterValue = convert(parameter);
+3 -1
View File
@@ -1,4 +1,4 @@
Spring Data Elasticsearch 4.3.7 (2021.1.7)
Spring Data Elasticsearch 4.3.9 (2021.1.9)
Copyright (c) [2013-2021] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -36,6 +36,8 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
@@ -129,6 +129,18 @@ public class ElasticsearchStringQueryUnitTests extends ElasticsearchStringQueryU
"{ 'bool' : { 'must' : { 'terms' : { 'name' : [\"hello \\\"Stranger\\\"\",\"Another string\"] } } } }");
}
@Test // #2326
@DisplayName("should escape backslashes in collection query parameters")
void shouldEscapeBackslashesInCollectionQueryParameters() throws NoSuchMethodException {
final List<String> parameters = Arrays.asList("param\\1", "param\\2");
List<String> params = new ArrayList<>(parameters);
org.springframework.data.elasticsearch.core.query.Query query = createQuery("findByNameIn", params);
assertThat(query).isInstanceOf(StringQuery.class);
assertThat(((StringQuery) query).getSource()).isEqualTo(
"{ 'bool' : { 'must' : { 'terms' : { 'name' : [\"param\\\\1\",\"param\\\\2\"] } } } }");
}
private org.springframework.data.elasticsearch.core.query.Query createQuery(String methodName, Object... args)
throws NoSuchMethodException {