From b57eb85a230d3a05e45276052ef62b1249e5a0e6 Mon Sep 17 00:00:00 2001 From: John Blum Date: Wed, 8 Jun 2022 12:42:17 -0700 Subject: [PATCH] Remove punctuation in Exception messages. Closes #2566. --- .../support/EnversRevisionRepositoryImpl.java | 12 +++--- .../ReflectionRevisionEntityInformation.java | 2 +- .../QueryByExamplePredicateBuilder.java | 8 ++-- .../data/jpa/domain/JpaSort.java | 28 ++++++------- .../AuditingBeanFactoryPostProcessor.java | 2 +- .../support/AuditingEntityListener.java | 6 +-- .../mapping/JpaMetamodelMappingContext.java | 6 +-- .../jpa/mapping/JpaPersistentEntityImpl.java | 6 +-- .../mapping/JpaPersistentPropertyImpl.java | 2 +- .../data/jpa/provider/JpaClassUtils.java | 4 +- .../jpa/provider/PersistenceProvider.java | 4 +- .../jpa/repository/cdi/JpaRepositoryBean.java | 2 +- .../cdi/JpaRepositoryExtension.java | 8 ++-- .../config/AuditingBeanDefinitionParser.java | 4 +- .../config/JpaAuditingRegistrar.java | 10 ++--- ...JpaMetamodelMappingContextFactoryBean.java | 4 +- .../repository/query/AbstractJpaQuery.java | 12 +++--- .../query/AbstractStringBasedJpaQuery.java | 10 ++--- .../query/DefaultJpaEntityMetadata.java | 2 +- .../repository/query/EmptyDeclaredQuery.java | 2 +- .../query/ExpressionBasedStringQuery.java | 6 +-- .../query/JSqlParserQueryEnhancer.java | 8 ++-- .../data/jpa/repository/query/Jpa21Utils.java | 18 ++++---- .../jpa/repository/query/JpaEntityGraph.java | 4 +- .../jpa/repository/query/JpaParameters.java | 4 +- .../jpa/repository/query/JpaQueryCreator.java | 6 +-- .../repository/query/JpaQueryExecution.java | 12 +++--- .../query/JpaQueryLookupStrategy.java | 16 +++---- .../jpa/repository/query/JpaQueryMethod.java | 10 ++--- .../repository/query/JpaResultConverters.java | 4 +- .../data/jpa/repository/query/NamedQuery.java | 12 +++--- .../jpa/repository/query/ParameterBinder.java | 6 +-- .../query/ParameterBinderFactory.java | 14 +++---- .../query/ParameterMetadataProvider.java | 12 +++--- .../repository/query/PartTreeJpaQuery.java | 8 ++-- .../query/QueryEnhancerFactory.java | 2 +- .../query/QueryParameterSetter.java | 4 +- .../query/QueryParameterSetterFactory.java | 32 +++++++------- .../data/jpa/repository/query/QueryUtils.java | 28 ++++++------- .../jpa/repository/query/SimpleJpaQuery.java | 4 +- .../query/StoredProcedureAttributeSource.java | 12 +++--- .../query/StoredProcedureAttributes.java | 4 +- .../query/StoredProcedureJpaQuery.java | 4 +- .../jpa/repository/query/StringQuery.java | 34 +++++++-------- .../CrudMethodMetadataPostProcessor.java | 2 +- .../repository/support/DefaultJpaContext.java | 10 ++--- .../repository/support/DefaultQueryHints.java | 4 +- .../FetchableFluentQueryByExample.java | 4 +- .../FetchableFluentQueryByPredicate.java | 4 +- .../FetchableFluentQueryBySpecification.java | 4 +- .../support/JpaEntityInformation.java | 2 +- .../support/JpaEntityInformationSupport.java | 4 +- .../JpaMetamodelEntityInformation.java | 10 ++--- .../support/JpaRepositoryFactory.java | 14 +++---- .../support/JpaRepositoryFactoryBean.java | 4 +- .../repository/support/QueryHintValue.java | 4 +- .../jpa/repository/support/QueryHints.java | 2 +- .../data/jpa/repository/support/Querydsl.java | 22 +++++----- .../support/QuerydslJpaPredicateExecutor.java | 24 +++++------ .../support/QuerydslJpaRepository.java | 6 +-- .../support/QuerydslRepositorySupport.java | 12 +++--- .../support/SimpleJpaRepository.java | 42 +++++++++---------- ...hScanningPersistenceUnitPostProcessor.java | 16 +++---- .../MergingPersistenceUnitManager.java | 4 +- .../data/jpa/util/JpaMetamodel.java | 6 +-- .../jpa/domain/sample/AuditorAwareStub.java | 2 +- .../jpa/domain/sample/SampleEntityPK.java | 4 +- .../infrastructure/HibernateTestUtils.java | 2 +- ...lipseLinkNamespaceUserRepositoryTests.java | 2 +- .../cdi/CdiExtensionIntegrationTests.java | 2 +- ...aQueryRewriterWithCdiIntegrationTests.java | 2 +- .../jpa/repository/query/Jpa21UtilsTests.java | 12 +++--- .../JpaQueryLookupStrategyUnitTests.java | 4 +- .../PartTreeJpaQueryIntegrationTests.java | 4 +- .../QueryParameterSetterFactoryUnitTests.java | 4 +- .../repository/sample/UserRepositoryImpl.java | 6 +-- .../JpaRepositoryFactoryUnitTests.java | 4 +- 77 files changed, 323 insertions(+), 323 deletions(-) diff --git a/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java b/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java index 838d647219..537c667830 100755 --- a/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java +++ b/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java @@ -77,7 +77,7 @@ public class EnversRevisionRepositoryImpl entityInformation, RevisionEntityInformation revisionEntityInformation, EntityManager entityManager) { - Assert.notNull(revisionEntityInformation, "RevisionEntityInformation must not be null!"); + Assert.notNull(revisionEntityInformation, "RevisionEntityInformation must not be null"); this.entityInformation = entityInformation; this.entityManager = entityManager; @@ -91,7 +91,7 @@ public Optional> findLastChangeRevision(ID id) { .setMaxResults(1) // .getResultList(); - Assert.state(singleResult.size() <= 1, "We expect at most one result."); + Assert.state(singleResult.size() <= 1, "We expect at most one result"); if (singleResult.isEmpty()) { return Optional.empty(); @@ -104,14 +104,14 @@ public Optional> findLastChangeRevision(ID id) { @SuppressWarnings("unchecked") public Optional> findRevision(ID id, N revisionNumber) { - Assert.notNull(id, "Identifier must not be null!"); - Assert.notNull(revisionNumber, "Revision number must not be null!"); + Assert.notNull(id, "Identifier must not be null"); + Assert.notNull(revisionNumber, "Revision number must not be null"); List singleResult = (List) createBaseQuery(id) // .add(AuditEntity.revisionNumber().eq(revisionNumber)) // .getResultList(); - Assert.state(singleResult.size() <= 1, "We expect at most one result."); + Assert.state(singleResult.size() <= 1, "We expect at most one result"); if (singleResult.isEmpty()) { return Optional.empty(); @@ -185,7 +185,7 @@ static class QueryResult { Assert.notNull(data, "Data must not be null"); Assert.isTrue( // data.length == 3, // - () -> String.format("Data must have length three, but has length %d.", data.length)); + () -> String.format("Data must have length three, but has length %d", data.length)); Assert.isTrue( // data[2] instanceof RevisionType, // () -> String.format("The third array element must be of type Revision type, but is of type %s", diff --git a/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/ReflectionRevisionEntityInformation.java b/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/ReflectionRevisionEntityInformation.java index 65d22ff772..c441ef9542 100644 --- a/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/ReflectionRevisionEntityInformation.java +++ b/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/ReflectionRevisionEntityInformation.java @@ -40,7 +40,7 @@ public class ReflectionRevisionEntityInformation implements RevisionEntityInform */ public ReflectionRevisionEntityInformation(Class revisionEntityClass) { - Assert.notNull(revisionEntityClass, "Revision entity type must not be null!"); + Assert.notNull(revisionEntityClass, "Revision entity type must not be null"); AnnotationDetectionFieldCallback fieldCallback = new AnnotationDetectionFieldCallback(RevisionNumber.class); ReflectionUtils.doWithFields(revisionEntityClass, fieldCallback); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilder.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilder.java index fc8732ec59..6949090e4c 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilder.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilder.java @@ -96,9 +96,9 @@ public static Predicate getPredicate(Root root, CriteriaBuilder cb, Examp public static Predicate getPredicate(Root root, CriteriaBuilder cb, Example example, EscapeCharacter escapeCharacter) { - Assert.notNull(root, "Root must not be null!"); - Assert.notNull(cb, "CriteriaBuilder must not be null!"); - Assert.notNull(example, "Example must not be null!"); + Assert.notNull(root, "Root must not be null"); + Assert.notNull(cb, "CriteriaBuilder must not be null"); + Assert.notNull(example, "Example must not be null"); ExampleMatcher matcher = example.getMatcher(); @@ -167,7 +167,7 @@ static List getPredicates(String path, CriteriaBuilder cb, Path fr PathNode node = currentNode.add(attribute.getName(), attributeValue); if (node.spansCycle()) { throw new InvalidDataAccessApiUsageException( - String.format("Path '%s' from root %s must not span a cyclic property reference!%n%s", currentPath, + String.format("Path '%s' from root %s must not span a cyclic property reference%n%s", currentPath, ClassUtils.getShortName(probeType), node)); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java index e43754cb08..5adc6fab85 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java @@ -145,7 +145,7 @@ public static JpaSort of(Direction direction, Path... paths) { */ public JpaSort and(@Nullable Direction direction, Attribute... attributes) { - Assert.notNull(attributes, "Attributes must not be null!"); + Assert.notNull(attributes, "Attributes must not be null"); return and(direction, paths(attributes)); } @@ -159,7 +159,7 @@ public JpaSort and(@Nullable Direction direction, Attribute... attributes) */ public JpaSort and(@Nullable Direction direction, Path... paths) { - Assert.notNull(paths, "Paths must not be null!"); + Assert.notNull(paths, "Paths must not be null"); List existing = new ArrayList<>(); @@ -179,7 +179,7 @@ public JpaSort and(@Nullable Direction direction, Path... paths) { */ public JpaSort andUnsafe(@Nullable Direction direction, String... properties) { - Assert.notEmpty(properties, "Properties must not be empty!"); + Assert.notEmpty(properties, "Properties must not be empty"); List orders = new ArrayList<>(); @@ -202,8 +202,8 @@ public JpaSort andUnsafe(@Nullable Direction direction, String... properties) { */ private static Path[] paths(Attribute[] attributes) { - Assert.notNull(attributes, "Attributes must not be null!"); - Assert.notEmpty(attributes, "Attributes must not be empty!"); + Assert.notNull(attributes, "Attributes must not be null"); + Assert.notEmpty(attributes, "Attributes must not be empty"); Path[] paths = new Path[attributes.length]; @@ -233,7 +233,7 @@ private static List combine(List orders, @Nullable Direction direc */ public static , T, S> Path path(A attribute) { - Assert.notNull(attribute, "Attribute must not be null!"); + Assert.notNull(attribute, "Attribute must not be null"); return new Path<>(Collections.singletonList(attribute)); } @@ -245,7 +245,7 @@ public static , T, S> Path path(A attribute) { */ public static

, T, S> Path path(P attribute) { - Assert.notNull(attribute, "Attribute must not be null!"); + Assert.notNull(attribute, "Attribute must not be null"); return new Path<>(Collections.singletonList(attribute)); } @@ -268,9 +268,9 @@ public static JpaSort unsafe(String... properties) { */ public static JpaSort unsafe(Direction direction, String... properties) { - Assert.notNull(direction, "Direction must not be null!"); - Assert.notEmpty(properties, "Properties must not be empty!"); - Assert.noNullElements(properties, "Properties must not contain null values!"); + Assert.notNull(direction, "Direction must not be null"); + Assert.notEmpty(properties, "Properties must not be empty"); + Assert.noNullElements(properties, "Properties must not contain null values"); return unsafe(direction, Arrays.asList(properties)); } @@ -284,7 +284,7 @@ public static JpaSort unsafe(Direction direction, String... properties) { */ public static JpaSort unsafe(Direction direction, List properties) { - Assert.notEmpty(properties, "Properties must not be empty!"); + Assert.notEmpty(properties, "Properties must not be empty"); List orders = new ArrayList<>(properties.size()); @@ -330,7 +330,7 @@ public , U> Path dot(A attribute) { private List> add(Attribute attribute) { - Assert.notNull(attribute, "Attribute must not be null!"); + Assert.notNull(attribute, "Attribute must not be null"); List> newAttributes = new ArrayList>(attributes.size() + 1); newAttributes.addAll(attributes); @@ -415,8 +415,8 @@ public JpaOrder with(NullHandling nullHandling) { */ public Sort withUnsafe(String... properties) { - Assert.notEmpty(properties, "Properties must not be empty!"); - Assert.noNullElements(properties, "Properties must not contain null values!"); + Assert.notEmpty(properties, "Properties must not be empty"); + Assert.noNullElements(properties, "Properties must not contain null values"); List orders = new ArrayList<>(properties.length); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingBeanFactoryPostProcessor.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingBeanFactoryPostProcessor.java index d3581f9d99..d76ca704ca 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingBeanFactoryPostProcessor.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingBeanFactoryPostProcessor.java @@ -44,7 +44,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) getBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME, beanFactory); } catch (NoSuchBeanDefinitionException o_O) { throw new IllegalStateException( - "Invalid auditing setup! Make sure you've used @EnableJpaAuditing or correctly!", o_O); + "Invalid auditing setup; Make sure you've used @EnableJpaAuditing or correctly", o_O); } for (String beanName : getEntityManagerFactoryBeanNames(beanFactory)) { diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingEntityListener.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingEntityListener.java index ca73ad9d9b..25dabceb61 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingEntityListener.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/AuditingEntityListener.java @@ -70,7 +70,7 @@ public class AuditingEntityListener { */ public void setAuditingHandler(ObjectFactory auditingHandler) { - Assert.notNull(auditingHandler, "AuditingHandler must not be null!"); + Assert.notNull(auditingHandler, "AuditingHandler must not be null"); this.handler = auditingHandler; } @@ -83,7 +83,7 @@ public void setAuditingHandler(ObjectFactory auditingHandler) { @PrePersist public void touchForCreate(Object target) { - Assert.notNull(target, "Entity must not be null!"); + Assert.notNull(target, "Entity must not be null"); if (handler != null) { @@ -103,7 +103,7 @@ public void touchForCreate(Object target) { @PreUpdate public void touchForUpdate(Object target) { - Assert.notNull(target, "Entity must not be null!"); + Assert.notNull(target, "Entity must not be null"); if (handler != null) { diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java index 0d129cccfc..a42e772660 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java @@ -54,8 +54,8 @@ public class JpaMetamodelMappingContext */ public JpaMetamodelMappingContext(Set models) { - Assert.notNull(models, "JPA metamodel must not be null!"); - Assert.notEmpty(models, "JPA metamodel must not be empty!"); + Assert.notNull(models, "JPA metamodel must not be null"); + Assert.notEmpty(models, "JPA metamodel must not be empty"); this.models = new Metamodels(models); this.persistenceProvider = PersistenceProvider.fromMetamodel(models.iterator().next()); @@ -137,7 +137,7 @@ public JpaMetamodel getRequiredMetamodel(TypeInformation type) { JpaMetamodel metamodel = getMetamodel(type); if (metamodel == null) { - throw new IllegalArgumentException(String.format("Required JpaMetamodel not found for %s!", type)); + throw new IllegalArgumentException(String.format("Required JpaMetamodel not found for %s", type)); } return metamodel; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentEntityImpl.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentEntityImpl.java index 2165ce61bf..e55d44a230 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentEntityImpl.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentEntityImpl.java @@ -41,7 +41,7 @@ class JpaPersistentEntityImpl extends BasicPersistentEntity information, ProxyIdAccessor p super(information, null); - Assert.notNull(proxyIdAccessor, "ProxyIdAccessor must not be null!"); + Assert.notNull(proxyIdAccessor, "ProxyIdAccessor must not be null"); this.proxyIdAccessor = proxyIdAccessor; this.metamodel = metamodel; } @@ -113,7 +113,7 @@ private static class JpaProxyAwareIdentifierAccessor extends IdPropertyIdentifie super(entity, bean); - Assert.notNull(proxyIdAccessor, "Proxy identifier accessor must not be null!"); + Assert.notNull(proxyIdAccessor, "Proxy identifier accessor must not be null"); this.proxyIdAccessor = proxyIdAccessor; this.bean = bean; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java index 46d72642ed..6ecb5270e3 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java @@ -99,7 +99,7 @@ public JpaPersistentPropertyImpl(JpaMetamodel metamodel, Property property, super(property, owner, simpleTypeHolder); - Assert.notNull(metamodel, "Metamodel must not be null!"); + Assert.notNull(metamodel, "Metamodel must not be null"); this.isAssociation = Lazy.of(() -> super.isAssociation() // || ASSOCIATION_ANNOTATIONS.stream().anyMatch(this::isAnnotationPresent)); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/JpaClassUtils.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/JpaClassUtils.java index dc3be2c4a7..ab68486d8e 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/JpaClassUtils.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/JpaClassUtils.java @@ -61,8 +61,8 @@ public static boolean isMetamodelOfType(Metamodel metamodel, String type) { private static boolean isOfType(Object source, String typeName, @Nullable ClassLoader classLoader) { - Assert.notNull(source, "Source instance must not be null!"); - Assert.hasText(typeName, "Target type name must not be null or empty!"); + Assert.notNull(source, "Source instance must not be null"); + Assert.hasText(typeName, "Target type name must not be null or empty"); try { return ClassUtils.forName(typeName, classLoader).isInstance(source); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/PersistenceProvider.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/PersistenceProvider.java index fa4f87f948..73a09f6313 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/PersistenceProvider.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/PersistenceProvider.java @@ -200,7 +200,7 @@ private static PersistenceProvider cacheAndReturn(Class type, PersistenceProv */ public static PersistenceProvider fromEntityManager(EntityManager em) { - Assert.notNull(em, "EntityManager must not be null!"); + Assert.notNull(em, "EntityManager must not be null"); Class entityManagerType = em.getDelegate().getClass(); PersistenceProvider cachedProvider = CACHE.get(entityManagerType); @@ -229,7 +229,7 @@ public static PersistenceProvider fromEntityManager(EntityManager em) { */ public static PersistenceProvider fromMetamodel(Metamodel metamodel) { - Assert.notNull(metamodel, "Metamodel must not be null!"); + Assert.notNull(metamodel, "Metamodel must not be null"); Class metamodelType = metamodel.getClass(); PersistenceProvider cachedProvider = CACHE.get(metamodelType); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryBean.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryBean.java index 01412b744b..9073a843f9 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryBean.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryBean.java @@ -60,7 +60,7 @@ class JpaRepositoryBean extends CdiRepositoryBean { super(qualifiers, repositoryType, beanManager, detector); - Assert.notNull(entityManagerBean, "EntityManager bean must not be null!"); + Assert.notNull(entityManagerBean, "EntityManager bean must not be null"); this.entityManagerBean = entityManagerBean; this.queryRewriterProvider = new BeanManagerQueryRewriterProvider(beanManager); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryExtension.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryExtension.java index 71634d5bc2..9cdb3bba1e 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryExtension.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/JpaRepositoryExtension.java @@ -52,7 +52,7 @@ public class JpaRepositoryExtension extends CdiRepositoryExtensionSupport { private final Map, Bean> entityManagers = new HashMap<>(); public JpaRepositoryExtension() { - LOGGER.info("Activating CDI extension for Spring Data JPA repositories."); + LOGGER.info("Activating CDI extension for Spring Data JPA repositories"); } /** @@ -71,7 +71,7 @@ void processBean(@Observes ProcessBean processBean) { if (type instanceof Class && EntityManager.class.isAssignableFrom((Class) type)) { Set qualifiers = new HashSet<>(bean.getQualifiers()); if (bean.isAlternative() || !entityManagers.containsKey(qualifiers)) { - LOGGER.debug(String.format("Discovered '%s' with qualifiers %s.", EntityManager.class.getName(), qualifiers)); + LOGGER.debug(String.format("Discovered '%s' with qualifiers %s", EntityManager.class.getName(), qualifiers)); entityManagers.put(qualifiers, (Bean) bean); } } @@ -94,7 +94,7 @@ void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanMan // Create the bean representing the repository. CdiRepositoryBean repositoryBean = createRepositoryBean(repositoryType, qualifiers, beanManager); - LOGGER.info(String.format("Registering bean for '%s' with qualifiers %s.", repositoryType.getName(), qualifiers)); + LOGGER.info(String.format("Registering bean for '%s' with qualifiers %s", repositoryType.getName(), qualifiers)); // Register the bean to the extension and the container. registerBean(repositoryBean); @@ -117,7 +117,7 @@ private CdiRepositoryBean createRepositoryBean(Class repositoryType, S Bean entityManagerBean = entityManagers.get(qualifiers); if (entityManagerBean == null) { - throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.", + throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s", EntityManager.class.getName(), qualifiers)); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java index 3b080f7b7a..79379625b7 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java @@ -97,8 +97,8 @@ public BeanDefinition parse(Element element, ParserContext parserContext) { if (!ClassUtils.isPresent(BEAN_CONFIGURER_ASPECT_CLASS_NAME, getClass().getClassLoader())) { parserContext.getReaderContext().error( "Could not configure Spring Data JPA auditing-feature because" - + " spring-aspects.jar is not on the classpath!\n" - + "If you want to use auditing please add spring-aspects.jar to the classpath.", element); + + " spring-aspects.jar is not on the classpath;\n" + + "If you want to use auditing please add spring-aspects.jar to the classpath", element); } RootBeanDefinition def = new RootBeanDefinition(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java index 9e536f42ef..fc0404169f 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java @@ -70,8 +70,8 @@ protected BeanDefinitionBuilder getAuditHandlerBeanDefinitionBuilder(AuditingCon @Override public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) { - Assert.notNull(annotationMetadata, "AnnotationMetadata must not be null!"); - Assert.notNull(registry, "BeanDefinitionRegistry must not be null!"); + Assert.notNull(annotationMetadata, "AnnotationMetadata must not be null"); + Assert.notNull(registry, "BeanDefinitionRegistry must not be null"); registerBeanConfigurerAspectIfNecessary(registry); super.registerBeanDefinitions(annotationMetadata, registry); @@ -106,10 +106,10 @@ private void registerBeanConfigurerAspectIfNecessary(BeanDefinitionRegistry regi } if (!ClassUtils.isPresent(BEAN_CONFIGURER_ASPECT_CLASS_NAME, getClass().getClassLoader())) { - throw new BeanDefinitionStoreException(BEAN_CONFIGURER_ASPECT_CLASS_NAME + " not found. \n" + throw new BeanDefinitionStoreException(BEAN_CONFIGURER_ASPECT_CLASS_NAME + " not found; \n" + "Could not configure Spring Data JPA auditing-feature because" - + " spring-aspects.jar is not on the classpath!\n" - + "If you want to use auditing please add spring-aspects.jar to the classpath."); + + " spring-aspects.jar is not on the classpath;\n" + + "If you want to use auditing please add spring-aspects.jar to the classpath"); } RootBeanDefinition def = new RootBeanDefinition(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaMetamodelMappingContextFactoryBean.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaMetamodelMappingContextFactoryBean.java index 96fff0518d..1d3d10b0fe 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaMetamodelMappingContextFactoryBean.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaMetamodelMappingContextFactoryBean.java @@ -69,7 +69,7 @@ protected JpaMetamodelMappingContext createInstance() { context.initialize(); if (LOG.isDebugEnabled()) { - LOG.debug("Finished initializing JpaMetamodelMappingContext!"); + LOG.debug("Finished initializing JpaMetamodelMappingContext"); } return context; @@ -83,7 +83,7 @@ protected JpaMetamodelMappingContext createInstance() { private Set getMetamodels() { if (beanFactory == null) { - throw new IllegalStateException("BeanFactory must not be null!"); + throw new IllegalStateException("BeanFactory must not be null"); } Collection factories = BeanFactoryUtils diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractJpaQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractJpaQuery.java index 52e9c3aa96..7fe6bafdea 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractJpaQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractJpaQuery.java @@ -80,8 +80,8 @@ public abstract class AbstractJpaQuery implements RepositoryQuery { */ public AbstractJpaQuery(JpaQueryMethod method, EntityManager em) { - Assert.notNull(method, "JpaQueryMethod must not be null!"); - Assert.notNull(em, "EntityManager must not be null!"); + Assert.notNull(method, "JpaQueryMethod must not be null"); + Assert.notNull(em, "EntityManager must not be null"); this.method = method; this.em = em; @@ -198,8 +198,8 @@ protected T applyHints(T query, JpaQueryMethod method) { */ protected void applyQueryHint(T query, QueryHint hint) { - Assert.notNull(query, "Query must not be null!"); - Assert.notNull(hint, "QueryHint must not be null!"); + Assert.notNull(query, "Query must not be null"); + Assert.notNull(hint, "QueryHint must not be null"); query.setHint(hint.name(), hint.value()); } @@ -297,7 +297,7 @@ static class TupleConverter implements Converter { */ public TupleConverter(ReturnedType type) { - Assert.notNull(type, "Returned type must not be null!"); + Assert.notNull(type, "Returned type must not be null"); this.type = type; } @@ -333,7 +333,7 @@ public Object convert(Object source) { */ private static class TupleBackedMap implements Map { - private static final String UNMODIFIABLE_MESSAGE = "A TupleBackedMap cannot be modified."; + private static final String UNMODIFIABLE_MESSAGE = "A TupleBackedMap cannot be modified"; private final Tuple tuple; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractStringBasedJpaQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractStringBasedJpaQuery.java index 20611985b0..64e61530f6 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractStringBasedJpaQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractStringBasedJpaQuery.java @@ -70,10 +70,10 @@ public AbstractStringBasedJpaQuery(JpaQueryMethod method, EntityManager em, Stri super(method, em); - Assert.hasText(queryString, "Query string must not be null or empty!"); - Assert.notNull(evaluationContextProvider, "ExpressionEvaluationContextProvider must not be null!"); - Assert.notNull(parser, "Parser must not be null!"); - Assert.notNull(queryRewriter, "QueryRewriter must not be null!"); + Assert.hasText(queryString, "Query string must not be null or empty"); + Assert.notNull(evaluationContextProvider, "ExpressionEvaluationContextProvider must not be null"); + Assert.notNull(parser, "Parser must not be null"); + Assert.notNull(queryRewriter, "QueryRewriter must not be null"); this.evaluationContextProvider = evaluationContextProvider; this.query = new ExpressionBasedStringQuery(queryString, method.getEntityInformation(), parser, @@ -87,7 +87,7 @@ public AbstractStringBasedJpaQuery(JpaQueryMethod method, EntityManager em, Stri this.queryRewriter = queryRewriter; Assert.isTrue(method.isNativeQuery() || !query.usesJdbcStyleParameters(), - "JDBC style parameters (?) are not supported for JPA queries."); + "JDBC style parameters (?) are not supported for JPA queries"); } @Override diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/DefaultJpaEntityMetadata.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/DefaultJpaEntityMetadata.java index 56b1551e9d..de2d8416a7 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/DefaultJpaEntityMetadata.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/DefaultJpaEntityMetadata.java @@ -38,7 +38,7 @@ public class DefaultJpaEntityMetadata implements JpaEntityMetadata { */ public DefaultJpaEntityMetadata(Class domainType) { - Assert.notNull(domainType, "Domain type must not be null!"); + Assert.notNull(domainType, "Domain type must not be null"); this.domainType = domainType; } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/EmptyDeclaredQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/EmptyDeclaredQuery.java index 725719785d..a2cf998401 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/EmptyDeclaredQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/EmptyDeclaredQuery.java @@ -67,7 +67,7 @@ public List getParameterBindings() { @Override public DeclaredQuery deriveCountQuery(@Nullable String countQuery, @Nullable String countQueryProjection) { - Assert.hasText(countQuery, "CountQuery must not be empty!"); + Assert.hasText(countQuery, "CountQuery must not be empty"); return DeclaredQuery.of(countQuery, false); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ExpressionBasedStringQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ExpressionBasedStringQuery.java index ce399d3212..8bb25aa6c6 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ExpressionBasedStringQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ExpressionBasedStringQuery.java @@ -85,9 +85,9 @@ static ExpressionBasedStringQuery from(DeclaredQuery query, JpaEntityMetadata private static String renderQueryIfExpressionOrReturnQuery(String query, JpaEntityMetadata metadata, SpelExpressionParser parser) { - Assert.notNull(query, "query must not be null!"); - Assert.notNull(metadata, "metadata must not be null!"); - Assert.notNull(parser, "parser must not be null!"); + Assert.notNull(query, "query must not be null"); + Assert.notNull(metadata, "metadata must not be null"); + Assert.notNull(parser, "parser must not be null"); if (!containsExpression(query)) { return query; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java index d8322ec8e5..9ac2bc7466 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java @@ -96,7 +96,7 @@ private ParsedType detectParsedType() { public String applySorting(Sort sort, @Nullable String alias) { String queryString = query.getQueryString(); - Assert.hasText(queryString, "Query must not be null or empty!"); + Assert.hasText(queryString, "Query must not be null or empty"); if (this.parsedType != ParsedType.SELECT) { return queryString; @@ -284,7 +284,7 @@ public String createCountQueryFor(@Nullable String countProjection) { return this.query.getQueryString(); } - Assert.hasText(this.query.getQueryString(), "OriginalQuery must not be null or empty!"); + Assert.hasText(this.query.getQueryString(), "OriginalQuery must not be null or empty"); Select selectStatement = parseSelectStatement(this.query.getQueryString()); PlainSelect selectBody = (PlainSelect) selectStatement.getSelectBody(); @@ -333,7 +333,7 @@ public String getProjection() { return ""; } - Assert.hasText(query.getQueryString(), "Query must not be null or empty!"); + Assert.hasText(query.getQueryString(), "Query must not be null or empty"); Select selectStatement = parseSelectStatement(query.getQueryString()); PlainSelect selectBody = (PlainSelect) selectStatement.getSelectBody(); @@ -360,7 +360,7 @@ private static Select parseSelectStatement(String query) { try { return (Select) CCJSqlParserUtil.parse(query); } catch (JSQLParserException e) { - throw new IllegalArgumentException("The query you provided is not a valid SQL Query!", e); + throw new IllegalArgumentException("The query you provided is not a valid SQL Query", e); } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/Jpa21Utils.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/Jpa21Utils.java index b8e7a561b3..30152a169b 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/Jpa21Utils.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/Jpa21Utils.java @@ -96,13 +96,13 @@ public static QueryHints getFetchGraphHint(EntityManager em, @Nullable JpaEntity @Nullable private static EntityGraph tryGetFetchGraph(EntityManager em, JpaEntityGraph jpaEntityGraph, Class entityType) { - Assert.notNull(em, "EntityManager must not be null!"); - Assert.notNull(jpaEntityGraph, "EntityGraph must not be null!"); - Assert.notNull(entityType, "EntityType must not be null!"); + Assert.notNull(em, "EntityManager must not be null"); + Assert.notNull(jpaEntityGraph, "EntityGraph must not be null"); + Assert.notNull(entityType, "EntityType must not be null"); - Assert.isTrue(JPA21_AVAILABLE, "The EntityGraph-Feature requires at least a JPA 2.1 persistence provider!"); + Assert.isTrue(JPA21_AVAILABLE, "The EntityGraph-Feature requires at least a JPA 2.1 persistence provider"); Assert.isTrue(GET_ENTITY_GRAPH_METHOD != null, - "It seems that you have the JPA 2.1 API but a JPA 2.0 implementation on the classpath!"); + "It seems that you have the JPA 2.1 API but a JPA 2.0 implementation on the classpath"); try { // first check whether an entityGraph with that name is already registered. @@ -125,10 +125,10 @@ private static EntityGraph tryGetFetchGraph(EntityManager em, JpaEntityGraph private static EntityGraph createDynamicEntityGraph(EntityManager em, JpaEntityGraph jpaEntityGraph, Class entityType) { - Assert.notNull(em, "EntityManager must not be null!"); - Assert.notNull(jpaEntityGraph, "JpaEntityGraph must not be null!"); - Assert.notNull(entityType, "Entity type must not be null!"); - Assert.isTrue(jpaEntityGraph.isAdHocEntityGraph(), "The given " + jpaEntityGraph + " is not dynamic!"); + Assert.notNull(em, "EntityManager must not be null"); + Assert.notNull(jpaEntityGraph, "JpaEntityGraph must not be null"); + Assert.notNull(entityType, "Entity type must not be null"); + Assert.isTrue(jpaEntityGraph.isAdHocEntityGraph(), "The given " + jpaEntityGraph + " is not dynamic"); EntityGraph entityGraph = em.createEntityGraph(entityType); configureFetchGraphFrom(jpaEntityGraph, entityGraph); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaEntityGraph.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaEntityGraph.java index e822ef9869..759a143e28 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaEntityGraph.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaEntityGraph.java @@ -60,8 +60,8 @@ public JpaEntityGraph(EntityGraph entityGraph, String nameFallback) { */ public JpaEntityGraph(String name, EntityGraphType type, @Nullable String[] attributePaths) { - Assert.hasText(name, "The name of an EntityGraph must not be null or empty!"); - Assert.notNull(type, "FetchGraphType must not be null!"); + Assert.hasText(name, "The name of an EntityGraph must not be null or empty"); + Assert.notNull(type, "FetchGraphType must not be null"); this.name = name; this.type = type; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaParameters.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaParameters.java index 5a5ce1d22f..329c01335d 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaParameters.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaParameters.java @@ -85,7 +85,7 @@ protected JpaParameter(MethodParameter parameter) { if (!isDateParameter() && hasTemporalParamAnnotation()) { throw new IllegalArgumentException( - Temporal.class.getSimpleName() + " annotation is only allowed on Date parameter!"); + Temporal.class.getSimpleName() + " annotation is only allowed on Date parameter"); } } @@ -127,7 +127,7 @@ TemporalType getRequiredTemporalType() throws IllegalStateException { return temporalType; } - throw new IllegalStateException(String.format("Required temporal type not found for %s!", getType())); + throw new IllegalStateException(String.format("Required temporal type not found for %s", getType())); } private boolean hasTemporalParamAnnotation() { diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java index 8a6527b119..836cca29fe 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java @@ -225,8 +225,8 @@ private class PredicateBuilder { */ public PredicateBuilder(Part part, Root root) { - Assert.notNull(part, "Part must not be null!"); - Assert.notNull(root, "Root must not be null!"); + Assert.notNull(part, "Part must not be null"); + Assert.notNull(root, "Root must not be null"); this.part = part; this.root = root; } @@ -312,7 +312,7 @@ public Predicate build() { case IS_NOT_EMPTY: if (!property.getLeafProperty().isCollection()) { - throw new IllegalArgumentException("IsEmpty / IsNotEmpty can only be used on collection properties!"); + throw new IllegalArgumentException("IsEmpty / IsNotEmpty can only be used on collection properties"); } Expression> collectionPath = traversePath(root, property); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryExecution.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryExecution.java index 2cc12a5a1a..0080670756 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryExecution.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryExecution.java @@ -81,8 +81,8 @@ public abstract class JpaQueryExecution { @Nullable public Object execute(AbstractJpaQuery query, JpaParametersParameterAccessor accessor) { - Assert.notNull(query, "AbstractJpaQuery must not be null!"); - Assert.notNull(accessor, "JpaParametersParameterAccessor must not be null!"); + Assert.notNull(query, "AbstractJpaQuery must not be null"); + Assert.notNull(accessor, "JpaParametersParameterAccessor must not be null"); Object result; @@ -211,7 +211,7 @@ static class ModifyingExecution extends JpaQueryExecution { */ public ModifyingExecution(JpaQueryMethod method, EntityManager em) { - Assert.notNull(em, "The EntityManager must not be null."); + Assert.notNull(em, "The EntityManager must not be null"); Class returnType = method.getReturnType(); @@ -219,7 +219,7 @@ public ModifyingExecution(JpaQueryMethod method, EntityManager em) { boolean isInt = ClassUtils.isAssignable(returnType, Integer.class); Assert.isTrue(isInt || isVoid, - "Modifying queries can only use void or int/Integer as return type! Offending method: " + method); + "Modifying queries can only use void or int/Integer as return type; Offending method: " + method); this.em = em; this.flush = method.getFlushAutomatically(); @@ -294,7 +294,7 @@ protected Object doExecute(AbstractJpaQuery query, JpaParametersParameterAccesso */ static class ProcedureExecution extends JpaQueryExecution { - private static final String NO_SURROUNDING_TRANSACTION = "You're trying to execute a @Procedure method without a surrounding transaction that keeps the connection open so that the ResultSet can actually be consumed. Make sure the consumer code uses @Transactional or any other way of declaring a (read-only) transaction."; + private static final String NO_SURROUNDING_TRANSACTION = "You're trying to execute a @Procedure method without a surrounding transaction that keeps the connection open so that the ResultSet can actually be consumed; Make sure the consumer code uses @Transactional or any other way of declaring a (read-only) transaction"; @Override protected Object doExecute(AbstractJpaQuery jpaQuery, JpaParametersParameterAccessor accessor) { @@ -331,7 +331,7 @@ protected Object doExecute(AbstractJpaQuery jpaQuery, JpaParametersParameterAcce */ static class StreamExecution extends JpaQueryExecution { - private static final String NO_SURROUNDING_TRANSACTION = "You're trying to execute a streaming query method without a surrounding transaction that keeps the connection open so that the Stream can actually be consumed. Make sure the code consuming the stream uses @Transactional or any other way of declaring a (read-only) transaction."; + private static final String NO_SURROUNDING_TRANSACTION = "You're trying to execute a streaming query method without a surrounding transaction that keeps the connection open so that the Stream can actually be consumed; Make sure the code consuming the stream uses @Transactional or any other way of declaring a (read-only) transaction"; private static Method streamMethod = ReflectionUtils.findMethod(Query.class, "getResultStream"); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java index 4df1c9ab8c..7fcab82bd5 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java @@ -80,8 +80,8 @@ private abstract static class AbstractQueryLookupStrategy implements QueryLookup public AbstractQueryLookupStrategy(EntityManager em, JpaQueryMethodFactory queryMethodFactory, QueryRewriterProvider queryRewriterProvider) { - Assert.notNull(em, "EntityManager must not be null!"); - Assert.notNull(queryMethodFactory, "JpaQueryMethodFactory must not be null!"); + Assert.notNull(em, "EntityManager must not be null"); + Assert.notNull(queryMethodFactory, "JpaQueryMethodFactory must not be null"); this.em = em; this.queryMethodFactory = queryMethodFactory; @@ -164,7 +164,7 @@ protected RepositoryQuery resolveQuery(JpaQueryMethod method, QueryRewriter quer if (method.hasAnnotatedQueryName()) { LOG.warn(String.format( - "Query method %s is annotated with both, a query and a query name. Using the declared query.", method)); + "Query method %s is annotated with both, a query and a query name; Using the declared query", method)); } return JpaQueryFactory.INSTANCE.fromMethodWithQueryString(method, em, method.getRequiredAnnotatedQuery(), @@ -238,8 +238,8 @@ public CreateIfNotFoundQueryLookupStrategy(EntityManager em, JpaQueryMethodFacto super(em, queryMethodFactory, queryRewriterProvider); - Assert.notNull(createStrategy, "CreateQueryLookupStrategy must not be null!"); - Assert.notNull(lookupStrategy, "DeclaredQueryLookupStrategy must not be null!"); + Assert.notNull(createStrategy, "CreateQueryLookupStrategy must not be null"); + Assert.notNull(lookupStrategy, "DeclaredQueryLookupStrategy must not be null"); this.createStrategy = createStrategy; this.lookupStrategy = lookupStrategy; @@ -272,8 +272,8 @@ public static QueryLookupStrategy create(EntityManager em, JpaQueryMethodFactory @Nullable Key key, QueryMethodEvaluationContextProvider evaluationContextProvider, QueryRewriterProvider queryRewriterProvider, EscapeCharacter escape) { - Assert.notNull(em, "EntityManager must not be null!"); - Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!"); + Assert.notNull(em, "EntityManager must not be null"); + Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null"); switch (key != null ? key : Key.CREATE_IF_NOT_FOUND) { case CREATE: @@ -287,7 +287,7 @@ public static QueryLookupStrategy create(EntityManager em, JpaQueryMethodFactory new DeclaredQueryLookupStrategy(em, queryMethodFactory, evaluationContextProvider, queryRewriterProvider), queryRewriterProvider); default: - throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key)); + throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s", key)); } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryMethod.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryMethod.java index e3138c5bd7..d510577d34 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryMethod.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryMethod.java @@ -108,8 +108,8 @@ protected JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionF super(method, metadata, factory); - Assert.notNull(method, "Method must not be null!"); - Assert.notNull(extractor, "Query extractor must not be null!"); + Assert.notNull(method, "Method must not be null"); + Assert.notNull(extractor, "Query extractor must not be null"); this.method = method; this.returnType = potentiallyUnwrapReturnTypeFor(metadata, method); @@ -137,7 +137,7 @@ protected JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionF this.entityMetadata = Lazy.of(() -> new DefaultJpaEntityMetadata<>(getDomainClass())); Assert.isTrue(!(isModifyingQuery() && getParameters().hasSpecialParameter()), - String.format("Modifying method must not contain %s!", Parameters.TYPES)); + String.format("Modifying method must not contain %s", Parameters.TYPES)); assertParameterNamesInAnnotatedQuery(); } @@ -171,7 +171,7 @@ private void assertParameterNamesInAnnotatedQuery() { || !annotatedQuery.contains(String.format(":%s", parameter.getName().get())) && !annotatedQuery.contains(String.format("#%s", parameter.getName().get()))) { throw new IllegalStateException( - String.format("Using named parameters for method %s but parameter '%s' not found in annotated query '%s'!", + String.format("Using named parameters for method %s but parameter '%s' not found in annotated query '%s'", method, parameter.getName(), annotatedQuery)); } } @@ -295,7 +295,7 @@ public String getRequiredAnnotatedQuery() throws IllegalStateException { return query; } - throw new IllegalStateException(String.format("No annotated query found for query method %s!", getName())); + throw new IllegalStateException(String.format("No annotated query found for query method %s", getName())); } /** diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaResultConverters.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaResultConverters.java index fb80a62d54..77dba961c9 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaResultConverters.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaResultConverters.java @@ -71,13 +71,13 @@ public byte[] convert(@Nullable Blob source) { } } catch (SQLException | IOException e) { - throw new DataRetrievalFailureException("Couldn't retrieve data from blob.", e); + throw new DataRetrievalFailureException("Couldn't retrieve data from blob", e); } finally { if (blobStream != null) { try { blobStream.close(); } catch (IOException e) { - throw new CleanupFailureDataAccessException("Couldn't close binary stream for given blob.", e); + throw new CleanupFailureDataAccessException("Couldn't close binary stream for given blob", e); } } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/NamedQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/NamedQuery.java index e79a39a3e8..b2b8a66d8a 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/NamedQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/NamedQuery.java @@ -40,9 +40,9 @@ final class NamedQuery extends AbstractJpaQuery { private static final String CANNOT_EXTRACT_QUERY = "Your persistence provider does not support extracting the JPQL query from a " - + "named query thus you can't use Pageable inside your query method. Make sure you " + + "named query thus you can't use Pageable inside your query method; Make sure you " + "have a JpaDialect configured at your EntityManagerFactoryBean as this affects " - + "discovering the concrete persistence provider."; + + "discovering the concrete persistence provider"; private static final Log LOG = LogFactory.getLog(NamedQuery.class); @@ -69,8 +69,8 @@ private NamedQuery(JpaQueryMethod method, EntityManager em) { Parameters parameters = method.getParameters(); if (parameters.hasSortParameter()) { - throw new IllegalStateException(String.format("Finder method %s is backed " + "by a NamedQuery and must " - + "not contain a sort parameter as we cannot modify the query! Use @Query instead!", method)); + throw new IllegalStateException(String.format("Finder method %s is backed by a NamedQuery and must " + + "not contain a sort parameter as we cannot modify the query; Use @Query instead", method)); } this.namedCountQueryIsPresent = hasNamedQuery(em, countQueryName); @@ -89,7 +89,7 @@ private NamedQuery(JpaQueryMethod method, EntityManager em) { if (parameters.hasPageableParameter()) { LOG.warn(String.format( - "Finder method %s is backed by a NamedQuery but contains a Pageable parameter! Sorting delivered via this Pageable will not be applied!", + "Finder method %s is backed by a NamedQuery but contains a Pageable parameter; Sorting delivered via this Pageable will not be applied", method)); } @@ -149,7 +149,7 @@ public static RepositoryQuery lookupFrom(JpaQueryMethod method, EntityManager em RepositoryQuery query = new NamedQuery(method, em); if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Found named query %s!", queryName)); + LOG.debug(String.format("Found named query %s", queryName)); } return query; } catch (IllegalArgumentException e) { diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinder.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinder.java index 49d129cd0f..af76bb5476 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinder.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinder.java @@ -33,7 +33,7 @@ */ public class ParameterBinder { - static final String PARAMETER_NEEDS_TO_BE_NAMED = "For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters."; + static final String PARAMETER_NEEDS_TO_BE_NAMED = "For queries with named parameters you need to use provide names for method parameters; Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters"; private final JpaParameters parameters; private final Iterable parameterSetters; @@ -62,8 +62,8 @@ public class ParameterBinder { public ParameterBinder(JpaParameters parameters, Iterable parameterSetters, boolean useJpaForPaging) { - Assert.notNull(parameters, "JpaParameters must not be null!"); - Assert.notNull(parameterSetters, "Parameter setters must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); + Assert.notNull(parameterSetters, "Parameter setters must not be null"); this.parameters = parameters; this.parameterSetters = parameterSetters; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinderFactory.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinderFactory.java index a16547cea6..77ebedf3d8 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinderFactory.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinderFactory.java @@ -44,7 +44,7 @@ class ParameterBinderFactory { */ static ParameterBinder createBinder(JpaParameters parameters) { - Assert.notNull(parameters, "JpaParameters must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); QueryParameterSetterFactory setterFactory = QueryParameterSetterFactory.basic(parameters); List bindings = getBindings(parameters); @@ -63,8 +63,8 @@ static ParameterBinder createBinder(JpaParameters parameters) { */ static ParameterBinder createCriteriaBinder(JpaParameters parameters, List> metadata) { - Assert.notNull(parameters, "JpaParameters must not be null!"); - Assert.notNull(metadata, "Parameter metadata must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); + Assert.notNull(metadata, "Parameter metadata must not be null"); QueryParameterSetterFactory setterFactory = QueryParameterSetterFactory.forCriteriaQuery(parameters, metadata); List bindings = getBindings(parameters); @@ -87,10 +87,10 @@ static ParameterBinder createCriteriaBinder(JpaParameters parameters, List bindings = query.getParameterBindings(); QueryParameterSetterFactory expressionSetterFactory = QueryParameterSetterFactory.parsing(parser, diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterMetadataProvider.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterMetadataProvider.java index e214ffe4c6..97696f1cfe 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterMetadataProvider.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterMetadataProvider.java @@ -96,9 +96,9 @@ public ParameterMetadataProvider(CriteriaBuilder builder, Parameters param private ParameterMetadataProvider(CriteriaBuilder builder, @Nullable Iterator bindableParameterValues, Parameters parameters, EscapeCharacter escape) { - Assert.notNull(builder, "CriteriaBuilder must not be null!"); - Assert.notNull(parameters, "Parameters must not be null!"); - Assert.notNull(escape, "EscapeCharacter must not be null!"); + Assert.notNull(builder, "CriteriaBuilder must not be null"); + Assert.notNull(parameters, "Parameters must not be null"); + Assert.notNull(escape, "EscapeCharacter must not be null"); this.builder = builder; this.parameters = parameters.getBindableParameters().iterator(); @@ -122,7 +122,7 @@ public List> getExpressions() { @SuppressWarnings("unchecked") public ParameterMetadata next(Part part) { - Assert.isTrue(parameters.hasNext(), () -> String.format("No parameter available for part %s.", part)); + Assert.isTrue(parameters.hasNext(), () -> String.format("No parameter available for part %s", part)); Parameter parameter = parameters.next(); return (ParameterMetadata) next(part, parameter.getType(), parameter); @@ -155,7 +155,7 @@ public ParameterMetadata next(Part part, Class type) { */ private ParameterMetadata next(Part part, Class type, Parameter parameter) { - Assert.notNull(type, "Type must not be null!"); + Assert.notNull(type, "Type must not be null"); /* * We treat Expression types as Object vales since the real value to be bound as a parameter is determined at query time. @@ -233,7 +233,7 @@ public boolean isIsNullParameter() { @Nullable public Object prepare(Object value) { - Assert.notNull(value, "Value must not be null!"); + Assert.notNull(value, "Value must not be null"); Class expressionType = expression.getJavaType(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/PartTreeJpaQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/PartTreeJpaQuery.java index 28c08f47ba..7ec72f9565 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/PartTreeJpaQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/PartTreeJpaQuery.java @@ -93,7 +93,7 @@ public class PartTreeJpaQuery extends AbstractJpaQuery { } catch (Exception o_O) { throw new IllegalArgumentException( - String.format("Failed to create query for method %s! %s", method, o_O.getMessage()), o_O); + String.format("Failed to create query for method %s; %s", method, o_O.getMessage()), o_O); } } @@ -147,7 +147,7 @@ private static void throwExceptionOnArgumentMismatch(String methodName, Part par if (!parameters.getBindableParameters().hasParameterAt(index)) { throw new IllegalStateException(String.format( - "Method %s expects at least %d arguments but only found %d. This leaves an operator of type %s for property %s unbound.", + "Method %s expects at least %d arguments but only found %d; This leaves an operator of type %s for property %s unbound", methodName, index + 1, index, type.name(), property)); } @@ -163,7 +163,7 @@ private static void throwExceptionOnArgumentMismatch(String methodName, Part par private static String wrongParameterTypeMessage(String methodName, String property, Type operatorType, String expectedArgumentType, JpaParameter parameter) { - return String.format("Operator %s on %s requires a %s argument, found %s in method %s.", operatorType.name(), + return String.format("Operator %s on %s requires a %s argument, found %s in method %s", operatorType.name(), property, expectedArgumentType, parameter.getType(), methodName); } @@ -223,7 +223,7 @@ public Query createQuery(JpaParametersParameterAccessor accessor) { } if (parameterBinder == null) { - throw new IllegalStateException("ParameterBinder is null!"); + throw new IllegalStateException("ParameterBinder is null"); } TypedQuery query = createQuery(criteriaQuery); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryEnhancerFactory.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryEnhancerFactory.java index 156a49aeec..8365122cdd 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryEnhancerFactory.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryEnhancerFactory.java @@ -68,7 +68,7 @@ private static boolean isJSqlParserInClassPath() { try { Class.forName("net.sf.jsqlparser.parser.JSqlParser", false, QueryEnhancerFactory.class.getClassLoader()); - LOG.info("JSqlParser is in classpath. If applicable JSqlParser will be used."); + LOG.info("JSqlParser is in classpath; If applicable JSqlParser will be used"); return true; } catch (ClassNotFoundException e) { return false; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetter.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetter.java index 8bc189e310..e3c40f18a6 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetter.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetter.java @@ -67,7 +67,7 @@ class NamedOrIndexedQueryParameterSetter implements QueryParameterSetter { NamedOrIndexedQueryParameterSetter(Function valueExtractor, Parameter parameter, @Nullable TemporalType temporalType) { - Assert.notNull(valueExtractor, "ValueExtractor must not be null!"); + Assert.notNull(valueExtractor, "ValueExtractor must not be null"); this.valueExtractor = valueExtractor; this.parameter = parameter; @@ -275,7 +275,7 @@ private static Class unwrapClass(Query query) { } catch (RuntimeException e) { - LogFactory.getLog(QueryMetadata.class).warn("Failed to unwrap actual class for Query proxy.", e); + LogFactory.getLog(QueryMetadata.class).warn("Failed to unwrap actual class for Query proxy", e); return queryType; } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactory.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactory.java index 72986cf4b2..c27abbd2be 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactory.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactory.java @@ -57,7 +57,7 @@ abstract class QueryParameterSetterFactory { */ static QueryParameterSetterFactory basic(JpaParameters parameters) { - Assert.notNull(parameters, "JpaParameters must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); return new BasicQueryParameterSetterFactory(parameters); } @@ -72,8 +72,8 @@ static QueryParameterSetterFactory basic(JpaParameters parameters) { */ static QueryParameterSetterFactory forCriteriaQuery(JpaParameters parameters, List> metadata) { - Assert.notNull(parameters, "JpaParameters must not be null!"); - Assert.notNull(metadata, "ParameterMetadata must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); + Assert.notNull(metadata, "ParameterMetadata must not be null"); return new CriteriaQueryParameterSetterFactory(parameters, metadata); } @@ -91,9 +91,9 @@ static QueryParameterSetterFactory forCriteriaQuery(JpaParameters parameters, Li static QueryParameterSetterFactory parsing(SpelExpressionParser parser, QueryMethodEvaluationContextProvider evaluationContextProvider, Parameters parameters) { - Assert.notNull(parser, "SpelExpressionParser must not be null!"); - Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!"); - Assert.notNull(parameters, "Parameters must not be null!"); + Assert.notNull(parser, "SpelExpressionParser must not be null"); + Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null"); + Assert.notNull(parameters, "Parameters must not be null"); return new ExpressionBasedQueryParameterSetterFactory(parser, evaluationContextProvider, parameters); } @@ -138,9 +138,9 @@ private static class ExpressionBasedQueryParameterSetterFactory extends QueryPar ExpressionBasedQueryParameterSetterFactory(SpelExpressionParser parser, QueryMethodEvaluationContextProvider evaluationContextProvider, Parameters parameters) { - Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!"); - Assert.notNull(parser, "SpelExpressionParser must not be null!"); - Assert.notNull(parameters, "Parameters must not be null!"); + Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null"); + Assert.notNull(parser, "SpelExpressionParser must not be null"); + Assert.notNull(parameters, "Parameters must not be null"); this.evaluationContextProvider = evaluationContextProvider; this.parser = parser; @@ -192,7 +192,7 @@ private static class BasicQueryParameterSetterFactory extends QueryParameterSett */ BasicQueryParameterSetterFactory(JpaParameters parameters) { - Assert.notNull(parameters, "JpaParameters must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); this.parameters = parameters; } @@ -200,7 +200,7 @@ private static class BasicQueryParameterSetterFactory extends QueryParameterSett @Override public QueryParameterSetter create(ParameterBinding binding, DeclaredQuery declaredQuery) { - Assert.notNull(binding, "Binding must not be null."); + Assert.notNull(binding, "Binding must not be null"); JpaParameter parameter; @@ -214,7 +214,7 @@ public QueryParameterSetter create(ParameterBinding binding, DeclaredQuery decla Assert.isTrue( // parameterIndex < bindableParameters.getNumberOfParameters(), // () -> String.format( // - "At least %s parameter(s) provided but only %s parameter(s) present in query.", // + "At least %s parameter(s) provided but only %s parameter(s) present in query", // binding.getRequiredPosition(), // bindableParameters.getNumberOfParameters() // ) // @@ -271,8 +271,8 @@ private static class CriteriaQueryParameterSetterFactory extends QueryParameterS */ CriteriaQueryParameterSetterFactory(JpaParameters parameters, List> metadata) { - Assert.notNull(parameters, "JpaParameters must not be null!"); - Assert.notNull(metadata, "Expressions must not be null!"); + Assert.notNull(parameters, "JpaParameters must not be null"); + Assert.notNull(metadata, "Expressions must not be null"); this.parameters = parameters; this.expressions = metadata; @@ -286,7 +286,7 @@ public QueryParameterSetter create(ParameterBinding binding, DeclaredQuery decla Assert.isTrue( // parameterIndex < expressions.size(), // () -> String.format( // - "At least %s parameter(s) provided but only %s parameter(s) present in query.", // + "At least %s parameter(s) provided but only %s parameter(s) present in query", // binding.getRequiredPosition(), // expressions.size() // ) // @@ -372,7 +372,7 @@ private static String getName(@Nullable JpaParameter parameter, ParameterBinding } return parameter.isNamedParameter() // - ? parameter.getName().orElseThrow(() -> new IllegalArgumentException("o_O parameter needs to have a name!")) // + ? parameter.getName().orElseThrow(() -> new IllegalArgumentException("o_O parameter needs to have a name")) // : null; } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java index 2a422e870f..bd39edc50b 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java @@ -133,8 +133,8 @@ public abstract class QueryUtils { private static final Pattern FIELD_ALIAS_PATTERN; private static final String UNSAFE_PROPERTY_REFERENCE = "Sort expression '%s' must only contain property references or " - + "aliases used in the select clause. If you really want to use something other than that for sorting, please use " - + "JpaSort.unsafe(…)!"; + + "aliases used in the select clause; If you really want to use something other than that for sorting, please use " + + "JpaSort.unsafe(…)"; static { @@ -231,7 +231,7 @@ public static String getExistsQueryString(String entityName, String countQueryPl */ public static String getQueryString(String template, String entityName) { - Assert.hasText(entityName, "Entity name must not be null or empty!"); + Assert.hasText(entityName, "Entity name must not be null or empty"); return String.format(template, entityName); } @@ -257,7 +257,7 @@ public static String applySorting(String query, Sort sort) { */ public static String applySorting(String query, Sort sort, @Nullable String alias) { - Assert.hasText(query, "Query must not be null or empty!"); + Assert.hasText(query, "Query must not be null or empty"); if (sort.isUnsorted()) { return query; @@ -518,9 +518,9 @@ private static Integer findClose(final Integer open, final List closes, public static Query applyAndBind(String queryString, Iterable entities, EntityManager entityManager) { - Assert.notNull(queryString, "Querystring must not be null!"); - Assert.notNull(entities, "Iterable of entities must not be null!"); - Assert.notNull(entityManager, "EntityManager must not be null!"); + Assert.notNull(queryString, "Querystring must not be null"); + Assert.notNull(entities, "Iterable of entities must not be null"); + Assert.notNull(entityManager, "EntityManager must not be null"); Iterator iterator = entities.iterator(); @@ -581,7 +581,7 @@ public static String createCountQueryFor(String originalQuery) { @Deprecated public static String createCountQueryFor(String originalQuery, @Nullable String countProjection) { - Assert.hasText(originalQuery, "OriginalQuery must not be null or empty!"); + Assert.hasText(originalQuery, "OriginalQuery must not be null or empty"); Matcher matcher = COUNT_MATCH.matcher(originalQuery); String countQuery; @@ -621,7 +621,7 @@ public static String createCountQueryFor(String originalQuery, @Nullable String */ public static boolean hasNamedParameter(Query query) { - Assert.notNull(query, "Query must not be null!"); + Assert.notNull(query, "Query must not be null"); for (Parameter parameter : query.getParameters()) { @@ -661,8 +661,8 @@ public static List toOrders(Sort sort, From< return Collections.emptyList(); } - Assert.notNull(from, "From must not be null!"); - Assert.notNull(cb, "CriteriaBuilder must not be null!"); + Assert.notNull(from, "From must not be null"); + Assert.notNull(cb, "CriteriaBuilder must not be null"); List orders = new ArrayList<>(); @@ -682,7 +682,7 @@ public static List toOrders(Sort sort, From< */ public static boolean hasConstructorExpression(String query) { - Assert.hasText(query, "Query must not be null or empty!"); + Assert.hasText(query, "Query must not be null or empty"); return CONSTRUCTOR_EXPRESSION.matcher(query).find(); } @@ -696,7 +696,7 @@ public static boolean hasConstructorExpression(String query) { */ public static String getProjection(String query) { - Assert.hasText(query, "Query must not be null or empty!"); + Assert.hasText(query, "Query must not be null or empty"); Matcher matcher = PROJECTION_CLAUSE.matcher(query); String projection = matcher.find() ? matcher.group(1) : ""; @@ -767,7 +767,7 @@ static Expression toExpressionRecursively(From from, PropertyPath p return (Expression) join; } - PropertyPath nextProperty = Objects.requireNonNull(property.next(), "An element of the property path is null!"); + PropertyPath nextProperty = Objects.requireNonNull(property.next(), "An element of the property path is null"); // recurse with the next property return toExpressionRecursively(join, nextProperty, isForSelection, requiresOuterJoin); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/SimpleJpaQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/SimpleJpaQuery.java index 1e765db9c3..c2e23738d5 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/SimpleJpaQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/SimpleJpaQuery.java @@ -67,11 +67,11 @@ public SimpleJpaQuery(JpaQueryMethod method, EntityManager em, String queryStrin super(method, em, queryString, countQueryString, queryRewriter, evaluationContextProvider, parser); - validateQuery(getQuery().getQueryString(), "Validation failed for query for method %s!", method); + validateQuery(getQuery().getQueryString(), "Validation failed for query for method %s", method); if (method.isPageQuery()) { validateQuery(getCountQuery().getQueryString(), - String.format("Count query validation failed for method %s!", method)); + String.format("Count query validation failed for method %s", method)); } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSource.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSource.java index db63ce83c0..8d321db926 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSource.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSource.java @@ -59,11 +59,11 @@ enum StoredProcedureAttributeSource { */ public StoredProcedureAttributes createFrom(Method method, JpaEntityMetadata entityMetadata) { - Assert.notNull(method, "Method must not be null!"); - Assert.notNull(entityMetadata, "EntityMetadata must not be null!"); + Assert.notNull(method, "Method must not be null"); + Assert.notNull(entityMetadata, "EntityMetadata must not be null"); Procedure procedure = AnnotatedElementUtils.findMergedAnnotation(method, Procedure.class); - Assert.notNull(procedure, "Method must have an @Procedure annotation!"); + Assert.notNull(procedure, "Method must have an @Procedure annotation"); NamedStoredProcedureQuery namedStoredProc = tryFindAnnotatedNamedStoredProcedureQuery(method, entityMetadata, procedure); @@ -179,9 +179,9 @@ private List extractOutputParametersFrom(NamedStoredPr private NamedStoredProcedureQuery tryFindAnnotatedNamedStoredProcedureQuery(Method method, JpaEntityMetadata entityMetadata, Procedure procedure) { - Assert.notNull(method, "Method must not be null!"); - Assert.notNull(entityMetadata, "EntityMetadata must not be null!"); - Assert.notNull(procedure, "Procedure must not be null!"); + Assert.notNull(method, "Method must not be null"); + Assert.notNull(entityMetadata, "EntityMetadata must not be null"); + Assert.notNull(procedure, "Procedure must not be null"); Class entityType = entityMetadata.getJavaType(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributes.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributes.java index 36e981c844..40cfcd2443 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributes.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributes.java @@ -63,8 +63,8 @@ class StoredProcedureAttributes { StoredProcedureAttributes(String procedureName, List outputProcedureParameters, boolean namedStoredProcedure) { - Assert.notNull(procedureName, "ProcedureName must not be null!"); - Assert.notNull(outputProcedureParameters, "OutputProcedureParameters must not be null!"); + Assert.notNull(procedureName, "ProcedureName must not be null"); + Assert.notNull(outputProcedureParameters, "OutputProcedureParameters must not be null"); Assert.isTrue(outputProcedureParameters.size() != 1 || outputProcedureParameters.get(0) != null, "ProcedureParameters must not have size 1 with a null value"); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureJpaQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureJpaQuery.java index f4af59547f..e7a5b02f21 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureJpaQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureJpaQuery.java @@ -96,7 +96,7 @@ protected StoredProcedureQuery doCreateQuery(JpaParametersParameterAccessor acce @Override protected TypedQuery doCreateCountQuery(JpaParametersParameterAccessor accessor) { - throw new UnsupportedOperationException("StoredProcedureQuery does not support count queries!"); + throw new UnsupportedOperationException("StoredProcedureQuery does not support count queries"); } /** @@ -110,7 +110,7 @@ protected TypedQuery doCreateCountQuery(JpaParametersParameterAccessor acc @Nullable Object extractOutputValue(StoredProcedureQuery storedProcedureQuery) { - Assert.notNull(storedProcedureQuery, "StoredProcedureQuery must not be null!"); + Assert.notNull(storedProcedureQuery, "StoredProcedureQuery must not be null"); if (!procedureAttributes.hasReturnValue()) { return null; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java index 994a7837c4..36ec1ca172 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java @@ -68,7 +68,7 @@ class StringQuery implements DeclaredQuery { @SuppressWarnings("deprecation") StringQuery(String query, boolean isNative) { - Assert.hasText(query, "Query must not be null or empty!"); + Assert.hasText(query, "Query must not be null or empty"); this.isNative = isNative; this.bindings = new ArrayList<>(); @@ -170,8 +170,8 @@ enum ParameterBindingParser { private static final Pattern NUMBERED_STYLE_PARAM = Pattern.compile(" \\?(?=\\d)"); // ?[digit] private static final Pattern NAMED_STYLE_PARAM = Pattern.compile(" :\\w+"); // :[text] - private static final String MESSAGE = "Already found parameter binding with same index / parameter name but differing binding type! " - + "Already have: %s, found %s! If you bind a parameter multiple times make sure they use the same binding."; + private static final String MESSAGE = "Already found parameter binding with same index / parameter name but differing binding type; " + + "Already have: %s, found %s; If you bind a parameter multiple times make sure they use the same binding"; private static final int INDEXED_PARAMETER_GROUP = 4; private static final int NAMED_PARAMETER_GROUP = 6; private static final int COMPARISION_TYPE_GROUP = 1; @@ -244,7 +244,7 @@ private String parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery(St String typeSource = matcher.group(COMPARISION_TYPE_GROUP); Assert.isTrue(parameterIndexString != null || parameterName != null, - () -> String.format("We need either a name or an index! Offending query string: %s", query)); + () -> String.format("We need either a name or an index; Offending query string: %s", query)); String expression = spelExtractor.getParameter(parameterName == null ? parameterIndexString : parameterName); String replacement = null; @@ -258,7 +258,7 @@ private String parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery(St } if (usesJpaStyleParameters && queryMeta.usesJdbcStyleParameters) { - throw new IllegalArgumentException("Mixing of ? parameters and other forms like ?1 is not supported!"); + throw new IllegalArgumentException("Mixing of ? parameters and other forms like ?1 is not supported"); } switch (ParameterBindingType.of(typeSource)) { @@ -417,7 +417,7 @@ static ParameterBindingType of(String typeSource) { } } - throw new IllegalArgumentException(String.format("Unsupported parameter binding type %s!", typeSource)); + throw new IllegalArgumentException(String.format("Unsupported parameter binding type %s", typeSource)); } } } @@ -453,11 +453,11 @@ static class ParameterBinding { ParameterBinding(@Nullable String name, @Nullable Integer position, @Nullable String expression) { if (name == null) { - Assert.notNull(position, "Position must not be null!"); + Assert.notNull(position, "Position must not be null"); } if (position == null) { - Assert.notNull(name, "Name must not be null!"); + Assert.notNull(name, "Name must not be null"); } this.name = name; @@ -502,7 +502,7 @@ String getRequiredName() throws IllegalStateException { return name; } - throw new IllegalStateException(String.format("Required name for %s not available!", this)); + throw new IllegalStateException(String.format("Required name for %s not available", this)); } /** @@ -526,7 +526,7 @@ int getRequiredPosition() throws IllegalStateException { return position; } - throw new IllegalStateException(String.format("Required position for %s not available!", this)); + throw new IllegalStateException(String.format("Required position for %s not available", this)); } /** @@ -657,11 +657,11 @@ static class LikeParameterBinding extends ParameterBinding { super(name, null, expression); - Assert.hasText(name, "Name must not be null or empty!"); - Assert.notNull(type, "Type must not be null!"); + Assert.hasText(name, "Name must not be null or empty"); + Assert.notNull(type, "Type must not be null"); Assert.isTrue(SUPPORTED_TYPES.contains(type), - String.format("Type must be one of %s!", StringUtils.collectionToCommaDelimitedString(SUPPORTED_TYPES))); + String.format("Type must be one of %s", StringUtils.collectionToCommaDelimitedString(SUPPORTED_TYPES))); this.type = type; } @@ -687,11 +687,11 @@ static class LikeParameterBinding extends ParameterBinding { super(null, position, expression); - Assert.isTrue(position > 0, "Position must be greater than zero!"); - Assert.notNull(type, "Type must not be null!"); + Assert.isTrue(position > 0, "Position must be greater than zero"); + Assert.notNull(type, "Type must not be null"); Assert.isTrue(SUPPORTED_TYPES.contains(type), - String.format("Type must be one of %s!", StringUtils.collectionToCommaDelimitedString(SUPPORTED_TYPES))); + String.format("Type must be one of %s", StringUtils.collectionToCommaDelimitedString(SUPPORTED_TYPES))); this.type = type; } @@ -763,7 +763,7 @@ public String toString() { */ private static Type getLikeTypeFrom(String expression) { - Assert.hasText(expression, "Expression must not be null or empty!"); + Assert.hasText(expression, "Expression must not be null or empty"); if (expression.matches("%.*%")) { return Type.CONTAINING; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/CrudMethodMetadataPostProcessor.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/CrudMethodMetadataPostProcessor.java index 69c9152ef5..5b286814ad 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/CrudMethodMetadataPostProcessor.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/CrudMethodMetadataPostProcessor.java @@ -190,7 +190,7 @@ private static class DefaultCrudMethodMetadata implements CrudMethodMetadata { */ DefaultCrudMethodMetadata(Method method) { - Assert.notNull(method, "Method must not be null!"); + Assert.notNull(method, "Method must not be null"); this.lockModeType = findLockModeType(method); this.queryHints = findQueryHints(method, it -> true); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultJpaContext.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultJpaContext.java index 1672f0ee41..4f0bb1dc00 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultJpaContext.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultJpaContext.java @@ -44,8 +44,8 @@ public class DefaultJpaContext implements JpaContext { */ public DefaultJpaContext(Set entityManagers) { - Assert.notNull(entityManagers, "EntityManagers must not be null!"); - Assert.notEmpty(entityManagers, "EntityManagers must not be empty!"); + Assert.notNull(entityManagers, "EntityManagers must not be null"); + Assert.notEmpty(entityManagers, "EntityManagers must not be empty"); this.entityManagers = new LinkedMultiValueMap<>(); @@ -59,10 +59,10 @@ public DefaultJpaContext(Set entityManagers) { @Override public EntityManager getEntityManagerByManagedType(Class type) { - Assert.notNull(type, "Type must not be null!"); + Assert.notNull(type, "Type must not be null"); if (!entityManagers.containsKey(type)) { - throw new IllegalArgumentException(String.format("%s is not a managed type!", type)); + throw new IllegalArgumentException(String.format("%s is not a managed type", type)); } List candidates = this.entityManagers.get(type); @@ -72,6 +72,6 @@ public EntityManager getEntityManagerByManagedType(Class type) { } throw new IllegalArgumentException( - String.format("%s managed by more than one EntityManagers: %s!", type.getName(), candidates)); + String.format("%s managed by more than one EntityManagers: %s", type.getName(), candidates)); } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultQueryHints.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultQueryHints.java index 9d8d114516..67d19a5509 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultQueryHints.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/DefaultQueryHints.java @@ -69,8 +69,8 @@ private DefaultQueryHints(JpaEntityInformation information, CrudMethodMeta */ public static QueryHints of(JpaEntityInformation information, CrudMethodMetadata metadata) { - Assert.notNull(information, "JpaEntityInformation must not be null!"); - Assert.notNull(metadata, "CrudMethodMetadata must not be null!"); + Assert.notNull(information, "JpaEntityInformation must not be null"); + Assert.notNull(metadata, "CrudMethodMetadata must not be null"); return new DefaultQueryHints(information, metadata, Optional.empty(), false); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByExample.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByExample.java index 315244a3a1..8e27ab733b 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByExample.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByExample.java @@ -81,7 +81,7 @@ private FetchableFluentQueryByExample(Example example, Class entityType, C @Override public FetchableFluentQuery sortBy(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); return new FetchableFluentQueryByExample<>(example, entityType, resultType, this.sort.and(sort), properties, finder, countOperation, existsOperation, entityManager, escapeCharacter); @@ -90,7 +90,7 @@ public FetchableFluentQuery sortBy(Sort sort) { @Override public FetchableFluentQuery as(Class resultType) { - Assert.notNull(resultType, "Projection target type must not be null!"); + Assert.notNull(resultType, "Projection target type must not be null"); if (!resultType.isInterface()) { throw new UnsupportedOperationException("Class-based DTOs are not yet supported."); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByPredicate.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByPredicate.java index 20fe4b7172..9eea021af0 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByPredicate.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryByPredicate.java @@ -84,7 +84,7 @@ private FetchableFluentQueryByPredicate(Predicate predicate, Class entityType @Override public FetchableFluentQuery sortBy(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); return new FetchableFluentQueryByPredicate<>(predicate, entityType, resultType, this.sort.and(sort), properties, finder, pagedFinder, countOperation, existsOperation, entityManager); @@ -93,7 +93,7 @@ public FetchableFluentQuery sortBy(Sort sort) { @Override public FetchableFluentQuery as(Class resultType) { - Assert.notNull(resultType, "Projection target type must not be null!"); + Assert.notNull(resultType, "Projection target type must not be null"); if (!resultType.isInterface()) { throw new UnsupportedOperationException("Class-based DTOs are not yet supported."); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryBySpecification.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryBySpecification.java index f8061ec5d2..1183936e74 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryBySpecification.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/FetchableFluentQueryBySpecification.java @@ -78,7 +78,7 @@ private FetchableFluentQueryBySpecification(Specification spec, Class enti @Override public FetchableFluentQuery sortBy(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); return new FetchableFluentQueryBySpecification<>(spec, entityType, resultType, this.sort.and(sort), properties, finder, countOperation, existsOperation, entityManager); @@ -87,7 +87,7 @@ public FetchableFluentQuery sortBy(Sort sort) { @Override public FetchableFluentQuery as(Class resultType) { - Assert.notNull(resultType, "Projection target type must not be null!"); + Assert.notNull(resultType, "Projection target type must not be null"); if (!resultType.isInterface()) { throw new UnsupportedOperationException("Class-based DTOs are not yet supported."); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformation.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformation.java index 0a75ea183f..71345b64d7 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformation.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformation.java @@ -54,7 +54,7 @@ public interface JpaEntityInformation extends EntityInformation, J } throw new IllegalArgumentException( - String.format("Could not obtain required identifier attribute for type %s!", getEntityName())); + String.format("Could not obtain required identifier attribute for type %s", getEntityName())); } /** diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformationSupport.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformationSupport.java index 29a6948815..a242ed224c 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformationSupport.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaEntityInformationSupport.java @@ -55,8 +55,8 @@ public JpaEntityInformationSupport(Class domainClass) { @SuppressWarnings({ "rawtypes", "unchecked" }) public static JpaEntityInformation getEntityInformation(Class domainClass, EntityManager em) { - Assert.notNull(domainClass, "Domain class must not be null!"); - Assert.notNull(em, "EntityManager must not be null!"); + Assert.notNull(domainClass, "Domain class must not be null"); + Assert.notNull(em, "EntityManager must not be null"); Metamodel metamodel = em.getMetamodel(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java index cdc386df0e..f9dfa20653 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java @@ -69,19 +69,19 @@ public JpaMetamodelEntityInformation(Class domainClass, Metamodel metamodel) super(domainClass); - Assert.notNull(metamodel, "Metamodel must not be null!"); + Assert.notNull(metamodel, "Metamodel must not be null"); this.metamodel = metamodel; ManagedType type = metamodel.managedType(domainClass); if (type == null) { - throw new IllegalArgumentException("The given domain class can not be found in the given Metamodel!"); + throw new IllegalArgumentException("The given domain class can not be found in the given Metamodel"); } this.entityName = type instanceof EntityType ? ((EntityType) type).getName() : null; if (!(type instanceof IdentifiableType)) { - throw new IllegalArgumentException("The given domain class does not contain an id attribute!"); + throw new IllegalArgumentException("The given domain class does not contain an id attribute"); } IdentifiableType identifiableType = (IdentifiableType) type; @@ -201,7 +201,7 @@ public Iterable getIdAttributeNames() { @Override public Object getCompositeIdAttributeValue(Object id, String idAttribute) { - Assert.isTrue(hasCompositeId(), "Model must have a composite Id!"); + Assert.isTrue(hasCompositeId(), "Model must have a composite Id"); return new DirectFieldAccessFallbackBeanWrapper(id).getPropertyValue(idAttribute); } @@ -409,7 +409,7 @@ private boolean isIdentifierDerivationNecessary(@Nullable Object value) { ManagedType managedType = this.metamodel.managedType(userClass); if (managedType == null) { - throw new IllegalStateException("ManagedType must not be null. We checked that it exists before."); + throw new IllegalStateException("ManagedType must not be null; We checked that it exists before."); } return managedType.getPersistenceType() == PersistenceType.ENTITY; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java index 46f8624c7e..12adf8f2b6 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java @@ -96,7 +96,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport { */ public JpaRepositoryFactory(EntityManager entityManager) { - Assert.notNull(entityManager, "EntityManager must not be null!"); + Assert.notNull(entityManager, "EntityManager must not be null"); this.entityManager = entityManager; this.extractor = PersistenceProvider.fromEntityManager(entityManager); @@ -137,7 +137,7 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setBeanFactory(beanFactory); - Assert.notNull(beanFactory, "BeanFactory must not be null!"); + Assert.notNull(beanFactory, "BeanFactory must not be null"); setQueryRewriterProvider(new BeanFactoryQueryRewriterProvider(beanFactory)); } @@ -149,7 +149,7 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { */ public void setEntityPathResolver(EntityPathResolver entityPathResolver) { - Assert.notNull(entityPathResolver, "EntityPathResolver must not be null!"); + Assert.notNull(entityPathResolver, "EntityPathResolver must not be null"); this.entityPathResolver = entityPathResolver; } @@ -170,7 +170,7 @@ public void setEscapeCharacter(EscapeCharacter escapeCharacter) { */ public void setQueryMethodFactory(JpaQueryMethodFactory queryMethodFactory) { - Assert.notNull(queryMethodFactory, "QueryMethodFactory must not be null!"); + Assert.notNull(queryMethodFactory, "QueryMethodFactory must not be null"); this.queryMethodFactory = queryMethodFactory; } @@ -184,7 +184,7 @@ public void setQueryMethodFactory(JpaQueryMethodFactory queryMethodFactory) { */ public void setQueryRewriterProvider(QueryRewriterProvider queryRewriterProvider) { - Assert.notNull(queryRewriterProvider, "QueryRewriterProvider must not be null!"); + Assert.notNull(queryRewriterProvider, "QueryRewriterProvider must not be null"); this.queryRewriterProvider = queryRewriterProvider; } @@ -312,7 +312,7 @@ private static boolean isTransactionNeeded(Class repositoryClass) { */ private static class EclipseLinkProjectionQueryCreationListener implements QueryCreationListener { - private static final String ECLIPSELINK_PROJECTIONS = "Usage of Spring Data projections detected on persistence provider EclipseLink. Make sure the following query methods declare result columns in exactly the order the accessors are declared in the projecting interface or the order of parameters for DTOs:"; + private static final String ECLIPSELINK_PROJECTIONS = "Usage of Spring Data projections detected on persistence provider EclipseLink; Make sure the following query methods declare result columns in exactly the order the accessors are declared in the projecting interface or the order of parameters for DTOs:"; private static final Log log = LogFactory.getLog(EclipseLinkProjectionQueryCreationListener.class); @@ -327,7 +327,7 @@ private static class EclipseLinkProjectionQueryCreationListener implements Query */ public EclipseLinkProjectionQueryCreationListener(EntityManager em) { - Assert.notNull(em, "EntityManager must not be null!"); + Assert.notNull(em, "EntityManager must not be null"); this.metamodel = JpaMetamodel.of(em.getMetamodel()); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java index f093e1247f..f866ef06b1 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java @@ -103,7 +103,7 @@ public void setQueryMethodFactory(@Nullable JpaQueryMethodFactory factory) { @Override protected RepositoryFactorySupport doCreateRepositoryFactory() { - Assert.state(entityManager != null, "EntityManager must not be null!"); + Assert.state(entityManager != null, "EntityManager must not be null"); return createRepositoryFactory(entityManager); } @@ -127,7 +127,7 @@ protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityM @Override public void afterPropertiesSet() { - Assert.state(entityManager != null, "EntityManager must not be null!"); + Assert.state(entityManager != null, "EntityManager must not be null"); super.afterPropertiesSet(); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHintValue.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHintValue.java index 6dcd0da94b..7052de795d 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHintValue.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHintValue.java @@ -32,8 +32,8 @@ public class QueryHintValue { public QueryHintValue(String name, Object value) { - Assert.notNull(name, "Name must not be null."); - Assert.notNull(value, "Value must not be null."); + Assert.notNull(name, "Name must not be null"); + Assert.notNull(value, "Value must not be null"); this.name = name; this.value = value; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHints.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHints.java index 9952790e5e..8f4ea196b8 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHints.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QueryHints.java @@ -42,7 +42,7 @@ public interface QueryHints { */ static QueryHints from(QueryHints... sources) { - Assert.notNull(sources, "Sources must not be null!"); + Assert.notNull(sources, "Sources must not be null"); MutableQueryHints result = new MutableQueryHints(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/Querydsl.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/Querydsl.java index 772b8ec5c3..cef0b06d17 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/Querydsl.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/Querydsl.java @@ -63,8 +63,8 @@ public class Querydsl { */ public Querydsl(EntityManager em, PathBuilder builder) { - Assert.notNull(em, "EntityManager must not be null!"); - Assert.notNull(builder, "PathBuilder must not be null!"); + Assert.notNull(em, "EntityManager must not be null"); + Assert.notNull(builder, "PathBuilder must not be null"); this.em = em; this.provider = PersistenceProvider.fromEntityManager(em); @@ -97,7 +97,7 @@ public AbstractJPAQuery> createQuery() { */ public AbstractJPAQuery> createQuery(EntityPath... paths) { - Assert.notNull(paths, "Paths must not be null!"); + Assert.notNull(paths, "Paths must not be null"); return createQuery().from(paths); } @@ -111,8 +111,8 @@ public AbstractJPAQuery> createQuery(EntityPath... p */ public JPQLQuery applyPagination(Pageable pageable, JPQLQuery query) { - Assert.notNull(pageable, "Pageable must not be null!"); - Assert.notNull(query, "JPQLQuery must not be null!"); + Assert.notNull(pageable, "Pageable must not be null"); + Assert.notNull(query, "JPQLQuery must not be null"); if (pageable.isUnpaged()) { return query; @@ -133,8 +133,8 @@ public JPQLQuery applyPagination(Pageable pageable, JPQLQuery query) { */ public JPQLQuery applySorting(Sort sort, JPQLQuery query) { - Assert.notNull(sort, "Sort must not be null!"); - Assert.notNull(query, "Query must not be null!"); + Assert.notNull(sort, "Sort must not be null"); + Assert.notNull(query, "Query must not be null"); if (sort.isUnsorted()) { return query; @@ -171,8 +171,8 @@ private JPQLQuery addOrderByFrom(QSort qsort, JPQLQuery query) { */ private JPQLQuery addOrderByFrom(Sort sort, JPQLQuery query) { - Assert.notNull(sort, "Sort must not be null!"); - Assert.notNull(query, "Query must not be null!"); + Assert.notNull(sort, "Sort must not be null"); + Assert.notNull(query, "Query must not be null"); for (Order order : sort) { query.orderBy(toOrderSpecifier(order)); @@ -205,7 +205,7 @@ private OrderSpecifier toOrderSpecifier(Order order) { */ private NullHandling toQueryDslNullHandling(org.springframework.data.domain.Sort.NullHandling nullHandling) { - Assert.notNull(nullHandling, "NullHandling must not be null!"); + Assert.notNull(nullHandling, "NullHandling must not be null"); switch (nullHandling) { @@ -229,7 +229,7 @@ private NullHandling toQueryDslNullHandling(org.springframework.data.domain.Sort */ private Expression buildOrderPropertyPathFrom(Order order) { - Assert.notNull(order, "Order must not be null!"); + Assert.notNull(order, "Order must not be null"); PropertyPath path = PropertyPath.from(order.getProperty(), builder.getType()); Expression sortPropertyExpression = builder; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaPredicateExecutor.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaPredicateExecutor.java index de10c83bc2..c4f4b07b99 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaPredicateExecutor.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaPredicateExecutor.java @@ -88,7 +88,7 @@ public QuerydslJpaPredicateExecutor(JpaEntityInformation entityInformation @Override public Optional findOne(Predicate predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); try { return Optional.ofNullable(createQuery(predicate).select(path).fetchOne()); @@ -100,7 +100,7 @@ public Optional findOne(Predicate predicate) { @Override public List findAll(Predicate predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); return createQuery(predicate).select(path).fetch(); } @@ -108,8 +108,8 @@ public List findAll(Predicate predicate) { @Override public List findAll(Predicate predicate, OrderSpecifier... orders) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(orders, "Order specifiers must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(orders, "Order specifiers must not be null"); return executeSorted(createQuery(predicate).select(path), orders); } @@ -117,8 +117,8 @@ public List findAll(Predicate predicate, OrderSpecifier... orders) { @Override public List findAll(Predicate predicate, Sort sort) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(sort, "Sort must not be null"); return executeSorted(createQuery(predicate).select(path), sort); } @@ -126,7 +126,7 @@ public List findAll(Predicate predicate, Sort sort) { @Override public List findAll(OrderSpecifier... orders) { - Assert.notNull(orders, "Order specifiers must not be null!"); + Assert.notNull(orders, "Order specifiers must not be null"); return executeSorted(createQuery(new Predicate[0]).select(path), orders); } @@ -134,8 +134,8 @@ public List findAll(OrderSpecifier... orders) { @Override public Page findAll(Predicate predicate, Pageable pageable) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(pageable, "Pageable must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(pageable, "Pageable must not be null"); final JPQLQuery countQuery = createCountQuery(predicate); JPQLQuery query = querydsl.applyPagination(pageable, createQuery(predicate).select(path)); @@ -147,8 +147,8 @@ public Page findAll(Predicate predicate, Pageable pageable) { @Override public R findBy(Predicate predicate, Function, R> queryFunction) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(queryFunction, "Query function must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(queryFunction, "Query function must not be null"); Function> finder = sort -> { AbstractJPAQuery select = (AbstractJPAQuery) createQuery(predicate).select(path); @@ -202,7 +202,7 @@ public boolean exists(Predicate predicate) { */ protected AbstractJPAQuery createQuery(Predicate... predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); AbstractJPAQuery query = doCreateQuery(getQueryHints().withFetchGraphs(entityManager), predicate); CrudMethodMetadata metadata = getRepositoryMethodMetadata(); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaRepository.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaRepository.java index 9f093211dc..3ef8c5db45 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaRepository.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaRepository.java @@ -120,7 +120,7 @@ public List findAll(Predicate predicate, OrderSpecifier... orders) { @Override public List findAll(Predicate predicate, Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); return executeSorted(createQuery(predicate).select(path), sort); } @@ -128,7 +128,7 @@ public List findAll(Predicate predicate, Sort sort) { @Override public List findAll(OrderSpecifier... orders) { - Assert.notNull(orders, "Order specifiers must not be null!"); + Assert.notNull(orders, "Order specifiers must not be null"); return executeSorted(createQuery(new Predicate[0]).select(path), orders); } @@ -136,7 +136,7 @@ public List findAll(OrderSpecifier... orders) { @Override public Page findAll(Predicate predicate, Pageable pageable) { - Assert.notNull(pageable, "Pageable must not be null!"); + Assert.notNull(pageable, "Pageable must not be null"); final JPQLQuery countQuery = createCountQuery(predicate); JPQLQuery query = querydsl.applyPagination(pageable, createQuery(predicate).select(path)); diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslRepositorySupport.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslRepositorySupport.java index f4f54c7709..89a49edab9 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslRepositorySupport.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslRepositorySupport.java @@ -54,7 +54,7 @@ public abstract class QuerydslRepositorySupport { */ public QuerydslRepositorySupport(Class domainClass) { - Assert.notNull(domainClass, "Domain class must not be null!"); + Assert.notNull(domainClass, "Domain class must not be null"); this.builder = new PathBuilderFactory().create(domainClass); } @@ -66,7 +66,7 @@ public QuerydslRepositorySupport(Class domainClass) { @Autowired public void setEntityManager(EntityManager entityManager) { - Assert.notNull(entityManager, "EntityManager must not be null!"); + Assert.notNull(entityManager, "EntityManager must not be null"); this.querydsl = new Querydsl(entityManager, builder); this.entityManager = entityManager; } @@ -76,8 +76,8 @@ public void setEntityManager(EntityManager entityManager) { */ @PostConstruct public void validate() { - Assert.notNull(entityManager, "EntityManager must not be null!"); - Assert.notNull(querydsl, "Querydsl must not be null!"); + Assert.notNull(entityManager, "EntityManager must not be null"); + Assert.notNull(querydsl, "Querydsl must not be null"); } /** @@ -154,7 +154,7 @@ protected Querydsl getQuerydsl() { private Querydsl getRequiredQuerydsl() { if (querydsl == null) { - throw new IllegalStateException("Querydsl is null!"); + throw new IllegalStateException("Querydsl is null"); } return querydsl; @@ -163,7 +163,7 @@ private Querydsl getRequiredQuerydsl() { private EntityManager getRequiredEntityManager() { if (entityManager == null) { - throw new IllegalStateException("EntityManager is null!"); + throw new IllegalStateException("EntityManager is null"); } return entityManager; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java index 9f4552d96f..f968c86ff3 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java @@ -91,7 +91,7 @@ @Transactional(readOnly = true) public class SimpleJpaRepository implements JpaRepositoryImplementation { - private static final String ID_MUST_NOT_BE_NULL = "The given id must not be null!"; + private static final String ID_MUST_NOT_BE_NULL = "The given id must not be null"; private final JpaEntityInformation entityInformation; private final EntityManager em; @@ -108,8 +108,8 @@ public class SimpleJpaRepository implements JpaRepositoryImplementation entityInformation, EntityManager entityManager) { - Assert.notNull(entityInformation, "JpaEntityInformation must not be null!"); - Assert.notNull(entityManager, "EntityManager must not be null!"); + Assert.notNull(entityInformation, "JpaEntityInformation must not be null"); + Assert.notNull(entityManager, "EntityManager must not be null"); this.entityInformation = entityInformation; this.em = entityManager; @@ -168,7 +168,7 @@ public void deleteById(ID id) { Assert.notNull(id, ID_MUST_NOT_BE_NULL); delete(findById(id).orElseThrow(() -> new EmptyResultDataAccessException( - String.format("No %s entity with id %s exists!", entityInformation.getJavaType(), id), 1))); + String.format("No %s entity with id %s exists", entityInformation.getJavaType(), id), 1))); } @Override @@ -176,7 +176,7 @@ public void deleteById(ID id) { @SuppressWarnings("unchecked") public void delete(T entity) { - Assert.notNull(entity, "Entity must not be null!"); + Assert.notNull(entity, "Entity must not be null"); if (entityInformation.isNew(entity)) { return; @@ -198,7 +198,7 @@ public void delete(T entity) { @Transactional public void deleteAllById(Iterable ids) { - Assert.notNull(ids, "Ids must not be null!"); + Assert.notNull(ids, "Ids must not be null"); for (ID id : ids) { deleteById(id); @@ -209,7 +209,7 @@ public void deleteAllById(Iterable ids) { @Transactional public void deleteAllByIdInBatch(Iterable ids) { - Assert.notNull(ids, "Ids must not be null!"); + Assert.notNull(ids, "Ids must not be null"); if (!ids.iterator().hasNext()) { return; @@ -246,7 +246,7 @@ public void deleteAllByIdInBatch(Iterable ids) { @Transactional public void deleteAll(Iterable entities) { - Assert.notNull(entities, "Entities must not be null!"); + Assert.notNull(entities, "Entities must not be null"); for (T entity : entities) { delete(entity); @@ -257,7 +257,7 @@ public void deleteAll(Iterable entities) { @Transactional public void deleteAllInBatch(Iterable entities) { - Assert.notNull(entities, "Entities must not be null!"); + Assert.notNull(entities, "Entities must not be null"); if (!entities.iterator().hasNext()) { return; @@ -387,7 +387,7 @@ public List findAll() { @Override public List findAllById(Iterable ids) { - Assert.notNull(ids, "Ids must not be null!"); + Assert.notNull(ids, "Ids must not be null"); if (!ids.iterator().hasNext()) { return Collections.emptyList(); @@ -533,8 +533,8 @@ public Page findAll(Example example, Pageable pageable) { @Override public R findBy(Example example, Function, R> queryFunction) { - Assert.notNull(example, "Sample must not be null!"); - Assert.notNull(queryFunction, "Query function must not be null!"); + Assert.notNull(example, "Sample must not be null"); + Assert.notNull(queryFunction, "Query function must not be null"); Function> finder = sort -> { @@ -553,8 +553,8 @@ public R findBy(Example example, Function R findBy(Specification spec, Function, R> queryFunction) { - Assert.notNull(spec, "Specification must not be null!"); - Assert.notNull(queryFunction, "Query function must not be null!"); + Assert.notNull(spec, "Specification must not be null"); + Assert.notNull(queryFunction, "Query function must not be null"); Function> finder = sort -> { return getQuery(spec, getDomainClass(), sort); @@ -580,7 +580,7 @@ public long count(@Nullable Specification spec) { @Override public S save(S entity) { - Assert.notNull(entity, "Entity must not be null."); + Assert.notNull(entity, "Entity must not be null"); if (entityInformation.isNew(entity)) { em.persist(entity); @@ -604,7 +604,7 @@ public S saveAndFlush(S entity) { @Override public List saveAll(Iterable entities) { - Assert.notNull(entities, "Entities must not be null!"); + Assert.notNull(entities, "Entities must not be null"); List result = new ArrayList<>(); @@ -770,8 +770,8 @@ protected TypedQuery getCountQuery(@Nullable Specification Root applySpecificationToCriteria(@Nullable Specification spec, Class domainClass, CriteriaQuery query) { - Assert.notNull(domainClass, "Domain class must not be null!"); - Assert.notNull(query, "CriteriaQuery must not be null!"); + Assert.notNull(domainClass, "Domain class must not be null"); + Assert.notNull(query, "CriteriaQuery must not be null"); Root root = query.from(domainClass); @@ -829,7 +829,7 @@ private void applyQueryHintsForCount(Query query) { */ private static long executeCountQuery(TypedQuery query) { - Assert.notNull(query, "TypedQuery must not be null!"); + Assert.notNull(query, "TypedQuery must not be null"); List totals = query.getResultList(); long total = 0L; @@ -898,8 +898,8 @@ private static class ExampleSpecification implements Specification { */ ExampleSpecification(Example example, EscapeCharacter escapeCharacter) { - Assert.notNull(example, "Example must not be null!"); - Assert.notNull(escapeCharacter, "EscapeCharacter must not be null!"); + Assert.notNull(example, "Example must not be null"); + Assert.notNull(escapeCharacter, "EscapeCharacter must not be null"); this.example = example; this.escapeCharacter = escapeCharacter; diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java index 3b85ad6535..77b91782d2 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java @@ -74,7 +74,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor */ public ClasspathScanningPersistenceUnitPostProcessor(String basePackage) { - Assert.hasText(basePackage, "Base package must not be null or empty!"); + Assert.hasText(basePackage, "Base package must not be null or empty"); this.basePackage = basePackage; } @@ -87,7 +87,7 @@ public ClasspathScanningPersistenceUnitPostProcessor(String basePackage) { */ public void setMappingFileNamePattern(String mappingFilePattern) { - Assert.hasText(mappingFilePattern, "Mapping file pattern must not be null or empty!"); + Assert.hasText(mappingFilePattern, "Mapping file pattern must not be null or empty"); this.mappingFileNamePattern = mappingFilePattern; } @@ -95,7 +95,7 @@ public void setMappingFileNamePattern(String mappingFilePattern) { @Override public void setResourceLoader(ResourceLoader resourceLoader) { - Assert.notNull(resourceLoader, "ResourceLoader must not be null!"); + Assert.notNull(resourceLoader, "ResourceLoader must not be null"); this.mappingFileResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader); this.resourceLoader = resourceLoader; @@ -104,7 +104,7 @@ public void setResourceLoader(ResourceLoader resourceLoader) { @Override public void setEnvironment(Environment environment) { - Assert.notNull(environment, "Environment must not be null!"); + Assert.notNull(environment, "Environment must not be null"); this.environment = environment; } @@ -121,7 +121,7 @@ public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui) { for (BeanDefinition definition : provider.findCandidateComponents(basePackage)) { - LOG.debug(String.format("Registering classpath-scanned entity %s in persistence unit info!", definition.getBeanClassName())); + LOG.debug(String.format("Registering classpath-scanned entity %s in persistence unit info", definition.getBeanClassName())); if (definition.getBeanClassName() != null) { pui.addManagedClassName(definition.getBeanClassName()); @@ -130,7 +130,7 @@ public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui) { for (String location : scanForMappingFileLocations()) { - LOG.debug(String.format("Registering classpath-scanned entity mapping file %s in persistence unit info!", location)); + LOG.debug(String.format("Registering classpath-scanned entity mapping file %s in persistence unit info", location)); pui.addMappingFileName(location); } @@ -165,7 +165,7 @@ private Set scanForMappingFileLocations() { try { scannedResources = mappingFileResolver.getResources(path); } catch (IOException e) { - throw new IllegalStateException(String.format("Cannot load mapping files from path %s!", path), e); + throw new IllegalStateException(String.format("Cannot load mapping files from path %s", path), e); } Set mappingFileUris = new HashSet<>(); @@ -179,7 +179,7 @@ private Set scanForMappingFileLocations() { mappingFileUris.add(resourcePathInClasspath); } catch (IOException e) { - throw new IllegalStateException(String.format("Couldn't get URI for %s!", resource), e); + throw new IllegalStateException(String.format("Couldn't get URI for %s", resource), e); } } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/MergingPersistenceUnitManager.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/MergingPersistenceUnitManager.java index c729ba812d..40d8224aa3 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/MergingPersistenceUnitManager.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/MergingPersistenceUnitManager.java @@ -62,7 +62,7 @@ void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui, PersistenceU if (!pui.getJarFileUrls().contains(url)) { if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Adding JAR file URL %s to persistence unit %s.", url, persistenceUnitName)); + LOG.debug(String.format("Adding JAR file URL %s to persistence unit %s", url, persistenceUnitName)); } pui.addJarFileUrl(url); } @@ -82,7 +82,7 @@ void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui, PersistenceU if (!pui.getMappingFileNames().contains(mappingFileName)) { if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Adding mapping file %s to persistence unit %s.", mappingFileName, persistenceUnitName)); + LOG.debug(String.format("Adding mapping file %s to persistence unit %s", mappingFileName, persistenceUnitName)); } pui.addMappingFileName(mappingFileName); } diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/util/JpaMetamodel.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/util/JpaMetamodel.java index 963e48d0a3..e34c940ebf 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/util/JpaMetamodel.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/util/JpaMetamodel.java @@ -59,7 +59,7 @@ public class JpaMetamodel { */ private JpaMetamodel(Metamodel metamodel) { - Assert.notNull(metamodel, "Metamodel must not be null!"); + Assert.notNull(metamodel, "Metamodel must not be null"); this.metamodel = metamodel; @@ -87,7 +87,7 @@ public static JpaMetamodel of(Metamodel metamodel) { */ public boolean isJpaManaged(Class type) { - Assert.notNull(type, "Type must not be null!"); + Assert.notNull(type, "Type must not be null"); return managedTypes.get().contains(type); } @@ -120,7 +120,7 @@ public boolean isSingleIdAttribute(Class entity, String name, Class attrib */ public boolean isMappedType(Class entity) { - Assert.notNull(entity, "Type must not be null!"); + Assert.notNull(entity, "Type must not be null"); if (!isJpaManaged(entity)) { return false; diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AuditorAwareStub.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AuditorAwareStub.java index b9f331f7ca..63570f18a4 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AuditorAwareStub.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AuditorAwareStub.java @@ -36,7 +36,7 @@ public class AuditorAwareStub implements AuditorAware { public AuditorAwareStub(AuditableUserRepository repository) { - Assert.notNull(repository, "AuditableUserRepository must not be null!"); + Assert.notNull(repository, "AuditableUserRepository must not be null"); this.repository = repository; } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleEntityPK.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleEntityPK.java index 6b100acc03..e3cacb1243 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleEntityPK.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleEntityPK.java @@ -40,8 +40,8 @@ public SampleEntityPK() { public SampleEntityPK(String first, String second) { - Assert.notNull(first, "First must not be null!"); - Assert.notNull(second, "Second must not be null!"); + Assert.notNull(first, "First must not be null"); + Assert.notNull(second, "Second must not be null"); this.first = first; this.second = second; } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/HibernateTestUtils.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/HibernateTestUtils.java index 29ffe8ccb6..5e4cfb9159 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/HibernateTestUtils.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/HibernateTestUtils.java @@ -55,6 +55,6 @@ public static PersistenceProvider getPersistenceProvider() { } } - throw new IllegalStateException("Could not obtain Hibernate PersistenceProvider!"); + throw new IllegalStateException("Could not obtain Hibernate PersistenceProvider"); } } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkNamespaceUserRepositoryTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkNamespaceUserRepositoryTests.java index 2dbc99d010..fa58802e68 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkNamespaceUserRepositoryTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkNamespaceUserRepositoryTests.java @@ -66,7 +66,7 @@ void queryProvidesCorrectNumberOfParametersForNativeQuery() { Query query = em.createNativeQuery("select 1 from User where firstname=? and lastname=?"); assertThat(query.getParameters()).describedAs( - "Due to a bug eclipse has size 0. If this is no longer the case the special code path triggered in NamedOrIndexedQueryParameterSetter.registerExcessParameters can be removed") + "Due to a bug eclipse has size 0; If this is no longer the case the special code path triggered in NamedOrIndexedQueryParameterSetter.registerExcessParameters can be removed") .hasSize(0); } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/CdiExtensionIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/CdiExtensionIntegrationTests.java index 55f1a30215..574682081c 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/CdiExtensionIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/CdiExtensionIntegrationTests.java @@ -51,7 +51,7 @@ static void setUpCdi() { .addPackages(PersonRepository.class) // .initialize(); - LOGGER.debug("CDI container bootstrapped!"); + LOGGER.debug("CDI container bootstrapped"); } @AfterAll diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/JpaQueryRewriterWithCdiIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/JpaQueryRewriterWithCdiIntegrationTests.java index 3077542d71..596b46d90c 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/JpaQueryRewriterWithCdiIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/JpaQueryRewriterWithCdiIntegrationTests.java @@ -67,7 +67,7 @@ static void setUpCdi() { .addPackages(UserRepositoryWithRewriter.class) // .initialize(); - LOGGER.debug("CDI container bootstrapped!"); + LOGGER.debug("CDI container bootstrapped"); } @AfterAll diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/Jpa21UtilsTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/Jpa21UtilsTests.java index b50bd96da5..e2192de93d 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/Jpa21UtilsTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/Jpa21UtilsTests.java @@ -255,7 +255,7 @@ AttributeNodeAssert terminatesGraphWith(String... nodeNames) { Assertions.assertThat(attributeNode.getSubgraphs()) // .describedAs( - String.format("Leaf properties %s could not be found. The node does not have any subgraphs.", nodes)) // + String.format("Leaf properties %s could not be found; The node does not have any subgraphs", nodes)) // .isNotNull() // .isNotEmpty(); @@ -267,13 +267,13 @@ AttributeNodeAssert terminatesGraphWith(String... nodeNames) { AttributeNode node = findNode(nodeName, graph.getAttributeNodes()); String notInSubgraph = String.format( - "AttributeNode '%s' could not be found in subgraph for '%s'. Know nodes are: %s.", nodeName, + "AttributeNode '%s' could not be found in subgraph for '%s'; Know nodes are: %s", nodeName, attributeNode.getAttributeName(), extractExistingAttributeNames(graph)); softly.assertThat(node).describedAs(notInSubgraph).isNotNull(); String notLeaf = String.format( - "AttributeNode %s of subgraph %s is not a leaf property but has %d SubGraph(s).", nodeName, + "AttributeNode %s of subgraph %s is not a leaf property but has %d SubGraph(s)", nodeName, attributeNode.getAttributeName(), node.getSubgraphs().size()); softly.assertThat(node.getSubgraphs()) // @@ -291,7 +291,7 @@ AttributeNodeAssert hasSubgraphs(String... subgraphNames) { Assertions.assertThat(attributeNode.getSubgraphs()) // .describedAs( - String.format("Subgraphs %s could not be found. The node does not have any subgraphs.", subgraphs)) // + String.format("Subgraphs %s could not be found; The node does not have any subgraphs", subgraphs)) // .isNotNull() // .isNotEmpty(); @@ -303,13 +303,13 @@ AttributeNodeAssert hasSubgraphs(String... subgraphNames) { AttributeNode node = findNode(subgraphName, graph.getAttributeNodes()); - String notFound = String.format("Subgraph '%s' could not be found in SubGraph for '%s'. Known nodes are: %s.", + String notFound = String.format("Subgraph '%s' could not be found in SubGraph for '%s'; Known nodes are: %s", subgraphName, attributeNode.getAttributeName(), extractExistingAttributeNames(graph)); softly.assertThat(node) // .describedAs(notFound) // .isNotNull(); - String notSubGraph = String.format("'%s' of SubGraph '%s' is not a SubGraph.", subgraphName, + String notSubGraph = String.format("'%s' of SubGraph '%s' is not a SubGraph", subgraphName, attributeNode.getAttributeName()); softly.assertThat(node.getSubgraphs()) // diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategyUnitTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategyUnitTests.java index 745d6cac5f..d95ca23060 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategyUnitTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategyUnitTests.java @@ -181,7 +181,7 @@ void namedQueryWithSortShouldThrowIllegalStateException() throws NoSuchMethodExc assertThatIllegalStateException() .isThrownBy(() -> strategy.resolveQuery(method, metadata, projectionFactory, namedQueries)) .withMessageContaining( - "is backed by a NamedQuery and must not contain a sort parameter as we cannot modify the query! Use @Query instead!"); + "is backed by a NamedQuery and must not contain a sort parameter as we cannot modify the query; Use @Query instead"); } @Test // GH-2018 @@ -211,7 +211,7 @@ void customQueryWithQuestionMarksShouldWork() throws NoSuchMethodException { RepositoryMetadata jdbcStyleMetadata = new DefaultRepositoryMetadata(UserRepository.class); strategy.resolveQuery(jdbcStyleMethod, jdbcStyleMetadata, projectionFactory, namedQueries); - }).withMessageContaining("JDBC style parameters (?) are not supported for JPA queries."); + }).withMessageContaining("JDBC style parameters (?) are not supported for JPA queries"); Method jpaStyleMethod = UserRepository.class.getMethod("customQueryWithQuestionMarksAndNumberedStyleParam", String.class); diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java index e79fa55c61..e0177b2133 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java @@ -254,11 +254,11 @@ private static T getValue(Object source, String path) { while (split.hasNext()) { - Assert.notNull(result, "result must not be null."); + Assert.notNull(result, "result must not be null"); result = getField(result, split.next()); } - Assert.notNull(result, "result must not be null."); + Assert.notNull(result, "result must not be null"); return (T) result; } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactoryUnitTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactoryUnitTests.java index ee126b0396..832dbc0ffd 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactoryUnitTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/QueryParameterSetterFactoryUnitTests.java @@ -79,7 +79,7 @@ void exceptionWhenCriteriaQueryContainsInsufficientAmountOfParameters() { assertThatExceptionOfType(IllegalArgumentException.class) // .isThrownBy(() -> setterFactory.create(binding, DeclaredQuery.of("QueryStringWith :NamedParameter", false))) // - .withMessage("At least 1 parameter(s) provided but only 0 parameter(s) present in query."); + .withMessage("At least 1 parameter(s) provided but only 0 parameter(s) present in query"); } @Test // DATAJPA-1281 @@ -93,6 +93,6 @@ void exceptionWhenBasicQueryContainsInsufficientAmountOfParameters() { assertThatExceptionOfType(IllegalArgumentException.class) // .isThrownBy(() -> setterFactory.create(binding, DeclaredQuery.of("QueryStringWith ?1", false))) // - .withMessage("At least 1 parameter(s) provided but only 0 parameter(s) present in query."); + .withMessage("At least 1 parameter(s) provided but only 0 parameter(s) present in query"); } } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryImpl.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryImpl.java index 0110d4560f..4757e2a543 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryImpl.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryImpl.java @@ -33,16 +33,16 @@ public class UserRepositoryImpl implements UserRepositoryCustom { @Autowired public UserRepositoryImpl(JpaContext context) { - Assert.notNull(context, "JpaContext must not be null!"); + Assert.notNull(context, "JpaContext must not be null"); } @Override public void someCustomMethod(User u) { - LOG.debug("Some custom method was invoked!"); + LOG.debug("Some custom method was invoked"); } @Override public void findByOverrridingMethod() { - LOG.debug("A method overriding a finder was invoked!"); + LOG.debug("A method overriding a finder was invoked"); } } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java index f922babaf9..c632917f72 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java @@ -210,13 +210,13 @@ private class SampleCustomRepositoryImpl implements SampleCustomRepository { @Override public void throwingRuntimeException() { - throw new IllegalArgumentException("You lose!"); + throw new IllegalArgumentException("You lose"); } @Override public void throwingCheckedException() throws IOException { - throw new IOException("You lose!"); + throw new IOException("You lose"); } }; }