DATAJPA-373 - Fixed potential NullPointerException in StringQuery.
This commit is contained in:
@@ -272,8 +272,8 @@ class StringQuery {
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public boolean hasPosition(int position) {
|
||||
return this.name == null && this.position == position;
|
||||
public boolean hasPosition(Integer position) {
|
||||
return position != null && this.name == null && this.position == position;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,6 +90,14 @@ public class StringQueryUnitTests {
|
||||
assertThat(binding.getType(), is(Type.ENDING_WITH));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-373
|
||||
*/
|
||||
@Test
|
||||
public void handlesMultipleNamedLikeBindingsCorrectly() {
|
||||
new StringQuery("select u from User u where u.firstname like %:firstname or foo like :bar");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsDifferentBindingsForRepeatedParameter() {
|
||||
new StringQuery("select u from User u where u.firstname like %?1 and u.lastname like ?1%");
|
||||
|
||||
Reference in New Issue
Block a user