Skip to content

Commit 6bae3c5

Browse files
committed
Polishing.
Original pull request #2324
1 parent 65aa03f commit 6bae3c5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ private boolean detectUpdatability() {
333333
continue;
334334
}
335335

336-
// may cause NullPointerException if the returned value is null
337-
return (boolean) AnnotationUtils.getValue(annotation, "updatable");
336+
final Object updatable = AnnotationUtils.getValue(annotation, "updatable");
337+
return (boolean) (updatable == null ? true : updatable);
338338
}
339339

340340
return true;

src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.springframework.data.jpa.repository.config;
1717

18+
import static org.springframework.data.jpa.repository.config.BeanDefinitionNames.*;
19+
1820
import java.lang.annotation.Annotation;
1921
import java.util.Arrays;
2022
import java.util.Collection;
@@ -52,8 +54,6 @@
5254
import org.springframework.util.ClassUtils;
5355
import org.springframework.util.StringUtils;
5456

55-
import static org.springframework.data.jpa.repository.config.BeanDefinitionNames.*;
56-
5757
/**
5858
* JPA specific configuration extension parsing custom attributes from the XML namespace and
5959
* {@link EnableJpaRepositories} annotation. Also, it registers bean definitions for a

src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ private String parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery(St
263263
Integer parameterIndex = getParameterIndex(parameterIndexString);
264264

265265
String typeSource = matcher.group(COMPARISION_TYPE_GROUP);
266+
Assert.isTrue(parameterIndexString != null || parameterName != null, () -> String.format("We need either a name or an index! Offending query string: %s", query));
266267
String expression = spelExtractor.getParameter(parameterName == null ? parameterIndexString : parameterName);
267268
String replacement = null;
268269

0 commit comments

Comments
 (0)