DATAMONGO-1608 - Add guard against NPE in MongoQueryCreator when using IgnoreCase.
Original Pull Request: #439
This commit is contained in:
committed by
Christoph Strobl
parent
439616c788
commit
eacfd2c172
@@ -55,6 +55,7 @@ import org.springframework.util.ClassUtils;
|
|||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
* @author Christoph Strobl
|
* @author Christoph Strobl
|
||||||
|
* @author Edward Prentice
|
||||||
*/
|
*/
|
||||||
class MongoQueryCreator extends AbstractQueryCreator<Query, Criteria> {
|
class MongoQueryCreator extends AbstractQueryCreator<Query, Criteria> {
|
||||||
|
|
||||||
@@ -297,7 +298,9 @@ class MongoQueryCreator extends AbstractQueryCreator<Query, Criteria> {
|
|||||||
criteria = criteria.not();
|
criteria = criteria.not();
|
||||||
}
|
}
|
||||||
|
|
||||||
return addAppropriateLikeRegexTo(criteria, part, parameters.next().toString());
|
Object next = parameters.next();
|
||||||
|
|
||||||
|
return addAppropriateLikeRegexTo(criteria, part, next != null ? next.toString() : "");
|
||||||
|
|
||||||
case NEVER:
|
case NEVER:
|
||||||
// intentional no-op
|
// intentional no-op
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ import org.springframework.test.util.ReflectionTestUtils;
|
|||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
* @author Christoph Strobl
|
* @author Christoph Strobl
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
|
* @author Fırat KÜÇÜK
|
||||||
|
* @author Edward Prentice
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
public abstract class AbstractPersonRepositoryIntegrationTests {
|
public abstract class AbstractPersonRepositoryIntegrationTests {
|
||||||
@@ -712,6 +714,17 @@ public abstract class AbstractPersonRepositoryIntegrationTests {
|
|||||||
assertThat(results.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS));
|
assertThat(results.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @see DATAMONGO-1608
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void findByFirstNameIgnoreCaseWithNull() {
|
||||||
|
|
||||||
|
List<Person> result = repository.findByFirstnameIgnoreCase(null);
|
||||||
|
|
||||||
|
assertThat(result.size(), is(0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DATAMONGO-770
|
* @see DATAMONGO-770
|
||||||
*/
|
*/
|
||||||
@@ -1010,7 +1023,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignored for now as this requires Querydsl 3.4.1 to succeed.
|
* Ignored for now as this requires Querydsl 3.4.1 to succeed.
|
||||||
*
|
*
|
||||||
* @see DATAMONGO-972
|
* @see DATAMONGO-972
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user