Browse Source

Use consistent wording in precondition error messages

pull/29496/head
Sam Brannen 2 years ago
parent
commit
2aa78889d2
  1. 4
      spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java
  2. 2
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
  3. 2
      spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
  4. 2
      spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java
  5. 4
      spring-core-test/src/main/java/org/springframework/aot/agent/InvocationsRecorderClassTransformer.java
  6. 4
      spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java
  7. 2
      spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsRecorder.java
  8. 33
      spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java
  9. 5
      spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java
  10. 4
      spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java
  11. 2
      spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java
  12. 12
      spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java
  13. 6
      spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java
  14. 2
      spring-core/src/main/java/org/springframework/util/AntPathMatcher.java
  15. 7
      spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java
  16. 2
      spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java
  17. 12
      spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java
  18. 22
      spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java
  19. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java
  20. 6
      spring-jms/src/main/java/org/springframework/jms/listener/adapter/JmsResponse.java
  21. 4
      spring-jms/src/main/java/org/springframework/jms/support/converter/MessagingMessageConverter.java
  22. 4
      spring-r2dbc/src/main/java/org/springframework/r2dbc/core/binding/BindMarkersFactory.java
  23. 4
      spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java
  24. 4
      spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java
  25. 7
      spring-web/src/main/java/org/springframework/http/ContentDisposition.java
  26. 6
      spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java
  27. 8
      spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractWebSocketSession.java

4
spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -82,7 +82,7 @@ public class RuntimeBeanReference implements BeanReference { @@ -82,7 +82,7 @@ public class RuntimeBeanReference implements BeanReference {
* @since 5.2
*/
public RuntimeBeanReference(Class<?> beanType, boolean toParent) {
Assert.notNull(beanType, "'beanType' must not be empty");
Assert.notNull(beanType, "'beanType' must not be null");
this.beanName = beanType.getName();
this.beanType = beanType;
this.toParent = toParent;

2
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

@ -1054,7 +1054,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp @@ -1054,7 +1054,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
@Override
public void setApplicationStartup(ApplicationStartup applicationStartup) {
Assert.notNull(applicationStartup, "applicationStartup should not be null");
Assert.notNull(applicationStartup, "applicationStartup must not be null");
this.applicationStartup = applicationStartup;
}

2
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -439,7 +439,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader @@ -439,7 +439,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
@Override
public void setApplicationStartup(ApplicationStartup applicationStartup) {
Assert.notNull(applicationStartup, "applicationStartup should not be null");
Assert.notNull(applicationStartup, "applicationStartup must not be null");
this.applicationStartup = applicationStartup;
}

2
spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java

@ -159,7 +159,7 @@ public class ScheduledAnnotationBeanPostProcessor @@ -159,7 +159,7 @@ public class ScheduledAnnotationBeanPostProcessor
* @since 5.1
*/
public ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar) {
Assert.notNull(registrar, "ScheduledTaskRegistrar is required");
Assert.notNull(registrar, "ScheduledTaskRegistrar must not be null");
this.registrar = registrar;
}

4
spring-core-test/src/main/java/org/springframework/aot/agent/InvocationsRecorderClassTransformer.java

@ -44,8 +44,8 @@ class InvocationsRecorderClassTransformer implements ClassFileTransformer { @@ -44,8 +44,8 @@ class InvocationsRecorderClassTransformer implements ClassFileTransformer {
private final String[] ignoredPackages;
public InvocationsRecorderClassTransformer(String[] instrumentedPackages, String[] ignoredPackages) {
Assert.notNull(instrumentedPackages, "instrumentedPackages should not be null");
Assert.notNull(ignoredPackages, "ignoredPackages should not be null");
Assert.notNull(instrumentedPackages, "instrumentedPackages must not be null");
Assert.notNull(ignoredPackages, "ignoredPackages must not be null");
this.instrumentedPackages = rewriteToAsmFormat(instrumentedPackages);
this.ignoredPackages = rewriteToAsmFormat(ignoredPackages);
}

4
spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java

@ -74,7 +74,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn @@ -74,7 +74,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn
* @throws AssertionError if any of the recorded invocations has no match in the provided hints
*/
public void match(RuntimeHints runtimeHints) {
Assert.notNull(runtimeHints, "RuntimeHints should not be null");
Assert.notNull(runtimeHints, "RuntimeHints must not be null");
configureRuntimeHints(runtimeHints);
List<RecordedInvocation> noMatchInvocations =
this.actual.recordedInvocations().filter(invocation -> !invocation.matches(runtimeHints)).toList();
@ -84,7 +84,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn @@ -84,7 +84,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn
}
public ListAssert<RecordedInvocation> notMatching(RuntimeHints runtimeHints) {
Assert.notNull(runtimeHints, "RuntimeHints should not be null");
Assert.notNull(runtimeHints, "RuntimeHints must not be null");
configureRuntimeHints(runtimeHints);
return ListAssert.assertThatStream(this.actual.recordedInvocations()
.filter(invocation -> !invocation.matches(runtimeHints)));

2
spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsRecorder.java

@ -48,7 +48,7 @@ public final class RuntimeHintsRecorder { @@ -48,7 +48,7 @@ public final class RuntimeHintsRecorder {
* @return the recorded invocations
*/
public synchronized static RuntimeHintsInvocations record(Runnable action) {
Assert.notNull(action, "Runnable action should not be null");
Assert.notNull(action, "Runnable action must not be null");
Assert.isTrue(RuntimeHintsAgent.isLoaded(), "RuntimeHintsAgent should be loaded in the current JVM");
RuntimeHintsRecorder recorder = new RuntimeHintsRecorder();
RecordedInvocationsPublisher.addListener(recorder.listener);

33
spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java

@ -51,6 +51,7 @@ public class ReflectionHintsPredicates { @@ -51,6 +51,7 @@ public class ReflectionHintsPredicates {
ReflectionHintsPredicates() {
}
/**
* Return a predicate that checks whether a reflection hint is registered for the given type.
* <p>The returned type exposes additional methods that refine the predicate behavior.
@ -58,7 +59,7 @@ public class ReflectionHintsPredicates { @@ -58,7 +59,7 @@ public class ReflectionHintsPredicates {
* @return the {@link RuntimeHints} predicate
*/
public TypeHintPredicate onType(TypeReference typeReference) {
Assert.notNull(typeReference, "'typeReference' should not be null");
Assert.notNull(typeReference, "'typeReference' must not be null");
return new TypeHintPredicate(typeReference);
}
@ -69,7 +70,7 @@ public class ReflectionHintsPredicates { @@ -69,7 +70,7 @@ public class ReflectionHintsPredicates {
* @return the {@link RuntimeHints} predicate
*/
public TypeHintPredicate onType(Class<?> type) {
Assert.notNull(type, "'type' should not be null");
Assert.notNull(type, "'type' must not be null");
return new TypeHintPredicate(TypeReference.of(type));
}
@ -81,7 +82,7 @@ public class ReflectionHintsPredicates { @@ -81,7 +82,7 @@ public class ReflectionHintsPredicates {
* @return the {@link RuntimeHints} predicate
*/
public ConstructorHintPredicate onConstructor(Constructor<?> constructor) {
Assert.notNull(constructor, "'constructor' should not be null");
Assert.notNull(constructor, "'constructor' must not be null");
return new ConstructorHintPredicate(constructor);
}
@ -93,7 +94,7 @@ public class ReflectionHintsPredicates { @@ -93,7 +94,7 @@ public class ReflectionHintsPredicates {
* @return the {@link RuntimeHints} predicate
*/
public MethodHintPredicate onMethod(Method method) {
Assert.notNull(method, "'method' should not be null");
Assert.notNull(method, "'method' must not be null");
return new MethodHintPredicate(method);
}
@ -108,8 +109,8 @@ public class ReflectionHintsPredicates { @@ -108,8 +109,8 @@ public class ReflectionHintsPredicates {
* @throws IllegalArgumentException if the method cannot be found or if multiple methods are found with the same name.
*/
public MethodHintPredicate onMethod(Class<?> type, String methodName) {
Assert.notNull(type, "'type' should not be null");
Assert.hasText(methodName, "'methodName' should not be empty");
Assert.notNull(type, "'type' must not be null");
Assert.hasText(methodName, "'methodName' must not be empty");
return new MethodHintPredicate(getMethod(type, methodName));
}
@ -125,8 +126,8 @@ public class ReflectionHintsPredicates { @@ -125,8 +126,8 @@ public class ReflectionHintsPredicates {
* @throws IllegalArgumentException if the method cannot be found or if multiple methods are found with the same name.
*/
public MethodHintPredicate onMethod(String className, String methodName) throws ClassNotFoundException {
Assert.hasText(className, "'className' should not be empty");
Assert.hasText(methodName, "'methodName' should not be empty");
Assert.hasText(className, "'className' must not be empty");
Assert.hasText(methodName, "'methodName' must not be empty");
return onMethod(Class.forName(className), methodName);
}
@ -155,8 +156,8 @@ public class ReflectionHintsPredicates { @@ -155,8 +156,8 @@ public class ReflectionHintsPredicates {
* @throws IllegalArgumentException if a field cannot be found with the given name.
*/
public FieldHintPredicate onField(Class<?> type, String fieldName) {
Assert.notNull(type, "'type' should not be null");
Assert.hasText(fieldName, "'fieldName' should not be empty");
Assert.notNull(type, "'type' must not be null");
Assert.hasText(fieldName, "'fieldName' must not be empty");
Field field = ReflectionUtils.findField(type, fieldName);
if (field == null) {
throw new IllegalArgumentException("No field named '%s' on class %s".formatted(fieldName, type.getName()));
@ -176,8 +177,8 @@ public class ReflectionHintsPredicates { @@ -176,8 +177,8 @@ public class ReflectionHintsPredicates {
* @throws IllegalArgumentException if a field cannot be found with the given name.
*/
public FieldHintPredicate onField(String className, String fieldName) throws ClassNotFoundException {
Assert.hasText(className, "'className' should not be empty");
Assert.hasText(fieldName, "'fieldName' should not be empty");
Assert.hasText(className, "'className' must not be empty");
Assert.hasText(fieldName, "'fieldName' must not be empty");
return onField(Class.forName(className), fieldName);
}
@ -189,7 +190,7 @@ public class ReflectionHintsPredicates { @@ -189,7 +190,7 @@ public class ReflectionHintsPredicates {
* @return the {@link RuntimeHints} predicate
*/
public FieldHintPredicate onField(Field field) {
Assert.notNull(field, "'field' should not be null");
Assert.notNull(field, "'field' must not be null");
return new FieldHintPredicate(field);
}
@ -218,7 +219,7 @@ public class ReflectionHintsPredicates { @@ -218,7 +219,7 @@ public class ReflectionHintsPredicates {
* @return the refined {@link RuntimeHints} predicate
*/
public Predicate<RuntimeHints> withMemberCategory(MemberCategory memberCategory) {
Assert.notNull(memberCategory, "'memberCategory' should not be null");
Assert.notNull(memberCategory, "'memberCategory' must not be null");
return this.and(hints -> getTypeHint(hints).getMemberCategories().contains(memberCategory));
}
@ -228,7 +229,7 @@ public class ReflectionHintsPredicates { @@ -228,7 +229,7 @@ public class ReflectionHintsPredicates {
* @return the refined {@link RuntimeHints} predicate
*/
public Predicate<RuntimeHints> withMemberCategories(MemberCategory... memberCategories) {
Assert.notEmpty(memberCategories, "'memberCategories' should not be empty");
Assert.notEmpty(memberCategories, "'memberCategories' must not be empty");
return this.and(hints -> getTypeHint(hints).getMemberCategories().containsAll(Arrays.asList(memberCategories)));
}
@ -238,7 +239,7 @@ public class ReflectionHintsPredicates { @@ -238,7 +239,7 @@ public class ReflectionHintsPredicates {
* @return the refined {@link RuntimeHints} predicate
*/
public Predicate<RuntimeHints> withAnyMemberCategory(MemberCategory... memberCategories) {
Assert.notEmpty(memberCategories, "'memberCategories' should not be empty");
Assert.notEmpty(memberCategories, "'memberCategories' must not be empty");
return this.and(hints -> Arrays.stream(memberCategories)
.anyMatch(memberCategory -> getTypeHint(hints).getMemberCategories().contains(memberCategory)));
}

5
spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java

@ -35,6 +35,7 @@ public class SerializationHintsPredicates { @@ -35,6 +35,7 @@ public class SerializationHintsPredicates {
SerializationHintsPredicates() {
}
/**
* Return a predicate that checks whether a {@link SerializationHints
* serialization hint} is registered for the given type.
@ -43,7 +44,7 @@ public class SerializationHintsPredicates { @@ -43,7 +44,7 @@ public class SerializationHintsPredicates {
* @see java.lang.reflect.Proxy
*/
public Predicate<RuntimeHints> onType(Class<?> type) {
Assert.notNull(type, "'type' should not be null");
Assert.notNull(type, "'type' must not be null");
return onType(TypeReference.of(type));
}
@ -55,7 +56,7 @@ public class SerializationHintsPredicates { @@ -55,7 +56,7 @@ public class SerializationHintsPredicates {
* @see java.lang.reflect.Proxy
*/
public Predicate<RuntimeHints> onType(TypeReference typeReference) {
Assert.notNull(typeReference, "'typeReference' should not be null");
Assert.notNull(typeReference, "'typeReference' must not be null");
return hints -> hints.serialization().javaSerializationHints().anyMatch(
hint -> hint.getType().equals(typeReference));
}

4
spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ public interface Converter<S, T> { @@ -57,7 +57,7 @@ public interface Converter<S, T> {
* @since 5.3
*/
default <U> Converter<S, U> andThen(Converter<? super T, ? extends U> after) {
Assert.notNull(after, "After Converter must not be null");
Assert.notNull(after, "'after' Converter must not be null");
return (S s) -> {
T initialResult = convert(s);
return (initialResult != null ? after.convert(initialResult) : null);

2
spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java

@ -114,7 +114,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> { @@ -114,7 +114,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
public ConversionServiceConverter(ConversionService conversionService, Class<? extends T> targetType) {
Assert.notNull(conversionService, "ConversionService must not be null");
Assert.notNull(targetType, "TargetType must not be null");
Assert.notNull(targetType, "'targetType' must not be null");
this.conversionService = conversionService;
this.targetType = targetType;
}

12
spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java

@ -100,7 +100,7 @@ public abstract class DataBufferUtils { @@ -100,7 +100,7 @@ public abstract class DataBufferUtils {
Callable<ReadableByteChannel> channelSupplier, DataBufferFactory bufferFactory, int bufferSize) {
Assert.notNull(channelSupplier, "'channelSupplier' must not be null");
Assert.notNull(bufferFactory, "'dataBufferFactory' must not be null");
Assert.notNull(bufferFactory, "'bufferFactory' must not be null");
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
return Flux.using(channelSupplier,
@ -140,7 +140,7 @@ public abstract class DataBufferUtils { @@ -140,7 +140,7 @@ public abstract class DataBufferUtils {
DataBufferFactory bufferFactory, int bufferSize) {
Assert.notNull(channelSupplier, "'channelSupplier' must not be null");
Assert.notNull(bufferFactory, "'dataBufferFactory' must not be null");
Assert.notNull(bufferFactory, "'bufferFactory' must not be null");
Assert.isTrue(position >= 0, "'position' must be >= 0");
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
@ -172,7 +172,7 @@ public abstract class DataBufferUtils { @@ -172,7 +172,7 @@ public abstract class DataBufferUtils {
Path path, DataBufferFactory bufferFactory, int bufferSize, OpenOption... options) {
Assert.notNull(path, "Path must not be null");
Assert.notNull(bufferFactory, "BufferFactory must not be null");
Assert.notNull(bufferFactory, "DataBufferFactory must not be null");
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
if (options.length > 0) {
for (OpenOption option : options) {
@ -420,7 +420,7 @@ public abstract class DataBufferUtils { @@ -420,7 +420,7 @@ public abstract class DataBufferUtils {
@SuppressWarnings("unchecked")
public static <T extends DataBuffer> Flux<T> takeUntilByteCount(Publisher<T> publisher, long maxByteCount) {
Assert.notNull(publisher, "Publisher must not be null");
Assert.isTrue(maxByteCount >= 0, "'maxByteCount' must be a positive number");
Assert.isTrue(maxByteCount >= 0, "'maxByteCount' must be >= 0");
return Flux.defer(() -> {
AtomicLong countDown = new AtomicLong(maxByteCount);
@ -453,7 +453,7 @@ public abstract class DataBufferUtils { @@ -453,7 +453,7 @@ public abstract class DataBufferUtils {
*/
public static <T extends DataBuffer> Flux<T> skipUntilByteCount(Publisher<T> publisher, long maxByteCount) {
Assert.notNull(publisher, "Publisher must not be null");
Assert.isTrue(maxByteCount >= 0, "'maxByteCount' must be a positive number");
Assert.isTrue(maxByteCount >= 0, "'maxByteCount' must be >= 0");
return Flux.defer(() -> {
AtomicLong countDown = new AtomicLong(maxByteCount);
@ -590,7 +590,7 @@ public abstract class DataBufferUtils { @@ -590,7 +590,7 @@ public abstract class DataBufferUtils {
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Mono<DataBuffer> join(Publisher<? extends DataBuffer> buffers, int maxByteCount) {
Assert.notNull(buffers, "'dataBuffers' must not be null");
Assert.notNull(buffers, "'buffers' must not be null");
if (buffers instanceof Mono mono) {
return mono;

6
spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,8 +45,8 @@ public class ResourceRegion { @@ -45,8 +45,8 @@ public class ResourceRegion {
*/
public ResourceRegion(Resource resource, long position, long count) {
Assert.notNull(resource, "Resource must not be null");
Assert.isTrue(position >= 0, "'position' must be larger than or equal to 0");
Assert.isTrue(count >= 0, "'count' must be larger than or equal to 0");
Assert.isTrue(position >= 0, "'position' must be greater than or equal to 0");
Assert.isTrue(count >= 0, "'count' must be greater than or equal to 0");
this.resource = resource;
this.position = position;
this.count = count;

2
spring-core/src/main/java/org/springframework/util/AntPathMatcher.java

@ -113,7 +113,7 @@ public class AntPathMatcher implements PathMatcher { @@ -113,7 +113,7 @@ public class AntPathMatcher implements PathMatcher {
* @since 4.1
*/
public AntPathMatcher(String pathSeparator) {
Assert.notNull(pathSeparator, "'pathSeparator' is required");
Assert.notNull(pathSeparator, "'pathSeparator' must not be null");
this.pathSeparator = pathSeparator;
this.pathSeparatorPatternCache = new PathSeparatorPatternCache(pathSeparator);
}

7
spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java

@ -29,7 +29,6 @@ import java.util.function.Function; @@ -29,7 +29,6 @@ import java.util.function.Function;
import org.springframework.lang.Nullable;
/**
* Simple LRU (Least Recently Used) cache, bounded by a specified cache capacity.
* <p>This is a simplified, opinionated implementation of a LRU cache for internal
@ -81,7 +80,7 @@ public final class ConcurrentLruCache<K, V> { @@ -81,7 +80,7 @@ public final class ConcurrentLruCache<K, V> {
}
private ConcurrentLruCache(int capacity, Function<K, V> generator, int concurrencyLevel) {
Assert.isTrue(capacity > 0, "Capacity should be > 0");
Assert.isTrue(capacity > 0, "Capacity must be > 0");
this.capacity = capacity;
this.cache = new ConcurrentHashMap<>(16, 0.75f, concurrencyLevel);
this.generator = generator;
@ -106,8 +105,8 @@ public final class ConcurrentLruCache<K, V> { @@ -106,8 +105,8 @@ public final class ConcurrentLruCache<K, V> {
}
private void put(K key, V value) {
Assert.notNull(key, "key should not be null");
Assert.notNull(value, "value should not be null");
Assert.notNull(key, "key must not be null");
Assert.notNull(value, "value must not be null");
final CacheEntry<V> cacheEntry = new CacheEntry<>(value, CacheEntryState.ACTIVE);
final Node<K, V> node = new Node<>(key, cacheEntry);
final Node<K, V> prior = this.cache.putIfAbsent(node.key, node);

2
spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java

@ -85,7 +85,7 @@ public class NullSafeComparator<T> implements Comparator<T> { @@ -85,7 +85,7 @@ public class NullSafeComparator<T> implements Comparator<T> {
* @param nullsLow whether to treat nulls lower or higher than non-null objects
*/
public NullSafeComparator(Comparator<T> comparator, boolean nullsLow) {
Assert.notNull(comparator, "Non-null Comparator is required");
Assert.notNull(comparator, "Comparator must not be null");
this.nonNullComparator = comparator;
this.nullsLow = nullsLow;
}

12
spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,7 +49,7 @@ public class SimpleNamespaceContext implements NamespaceContext { @@ -49,7 +49,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
@Override
public String getNamespaceURI(String prefix) {
Assert.notNull(prefix, "No prefix given");
Assert.notNull(prefix, "'prefix' must not be null");
if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
return XMLConstants.XML_NS_URI;
}
@ -78,7 +78,7 @@ public class SimpleNamespaceContext implements NamespaceContext { @@ -78,7 +78,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
}
private Set<String> getPrefixesSet(String namespaceUri) {
Assert.notNull(namespaceUri, "No namespaceUri given");
Assert.notNull(namespaceUri, "'namespaceUri' must not be null");
if (this.defaultNamespaceUri.equals(namespaceUri)) {
return Collections.singleton(XMLConstants.DEFAULT_NS_PREFIX);
}
@ -114,11 +114,11 @@ public class SimpleNamespaceContext implements NamespaceContext { @@ -114,11 +114,11 @@ public class SimpleNamespaceContext implements NamespaceContext {
/**
* Bind the given prefix to the given namespace.
* @param prefix the namespace prefix
* @param namespaceUri the namespace uri
* @param namespaceUri the namespace URI
*/
public void bindNamespaceUri(String prefix, String namespaceUri) {
Assert.notNull(prefix, "No prefix given");
Assert.notNull(namespaceUri, "No namespaceUri given");
Assert.notNull(prefix, "'prefix' must not be null");
Assert.notNull(namespaceUri, "'namespaceUri' must not be null");
if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
this.defaultNamespaceUri = namespaceUri;
}

22
spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java

@ -249,7 +249,7 @@ public class SpelExpression implements Expression { @@ -249,7 +249,7 @@ public class SpelExpression implements Expression {
@Override
@Nullable
public Object getValue(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
CompiledExpression compiledAst = this.compiledAst;
if (compiledAst != null) {
@ -279,7 +279,7 @@ public class SpelExpression implements Expression { @@ -279,7 +279,7 @@ public class SpelExpression implements Expression {
@Override
@Nullable
public <T> T getValue(EvaluationContext context, @Nullable Class<T> expectedResultType) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
CompiledExpression compiledAst = this.compiledAst;
if (compiledAst != null) {
@ -314,7 +314,7 @@ public class SpelExpression implements Expression { @@ -314,7 +314,7 @@ public class SpelExpression implements Expression {
@Override
@Nullable
public Object getValue(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
CompiledExpression compiledAst = this.compiledAst;
if (compiledAst != null) {
@ -346,7 +346,7 @@ public class SpelExpression implements Expression { @@ -346,7 +346,7 @@ public class SpelExpression implements Expression {
public <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Class<T> expectedResultType)
throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
CompiledExpression compiledAst = this.compiledAst;
if (compiledAst != null) {
@ -393,7 +393,7 @@ public class SpelExpression implements Expression { @@ -393,7 +393,7 @@ public class SpelExpression implements Expression {
@Override
@Nullable
public Class<?> getValueType(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
ExpressionState expressionState = new ExpressionState(context, this.configuration);
TypeDescriptor typeDescriptor = this.ast.getValueInternal(expressionState).getTypeDescriptor();
return (typeDescriptor != null ? typeDescriptor.getType() : null);
@ -424,7 +424,7 @@ public class SpelExpression implements Expression { @@ -424,7 +424,7 @@ public class SpelExpression implements Expression {
@Override
@Nullable
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
ExpressionState expressionState = new ExpressionState(context, this.configuration);
return this.ast.getValueInternal(expressionState).getTypeDescriptor();
}
@ -434,7 +434,7 @@ public class SpelExpression implements Expression { @@ -434,7 +434,7 @@ public class SpelExpression implements Expression {
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Object rootObject)
throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
ExpressionState expressionState = new ExpressionState(context, toTypedValue(rootObject), this.configuration);
return this.ast.getValueInternal(expressionState).getTypeDescriptor();
}
@ -447,13 +447,13 @@ public class SpelExpression implements Expression { @@ -447,13 +447,13 @@ public class SpelExpression implements Expression {
@Override
public boolean isWritable(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
return this.ast.isWritable(new ExpressionState(context, this.configuration));
}
@Override
public boolean isWritable(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
return this.ast.isWritable(new ExpressionState(context, toTypedValue(rootObject), this.configuration));
}
@ -465,7 +465,7 @@ public class SpelExpression implements Expression { @@ -465,7 +465,7 @@ public class SpelExpression implements Expression {
@Override
public void setValue(EvaluationContext context, @Nullable Object value) throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
this.ast.setValue(new ExpressionState(context, this.configuration), value);
}
@ -473,7 +473,7 @@ public class SpelExpression implements Expression { @@ -473,7 +473,7 @@ public class SpelExpression implements Expression {
public void setValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Object value)
throws EvaluationException {
Assert.notNull(context, "EvaluationContext is required");
Assert.notNull(context, "EvaluationContext must not be null");
this.ast.setValue(new ExpressionState(context, toTypedValue(rootObject), this.configuration), value);
}

4
spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -80,7 +80,7 @@ public class RowMapperResultSetExtractor<T> implements ResultSetExtractor<List<T @@ -80,7 +80,7 @@ public class RowMapperResultSetExtractor<T> implements ResultSetExtractor<List<T
* (just used for optimized collection handling)
*/
public RowMapperResultSetExtractor(RowMapper<T> rowMapper, int rowsExpected) {
Assert.notNull(rowMapper, "RowMapper is required");
Assert.notNull(rowMapper, "RowMapper must not be null");
this.rowMapper = rowMapper;
this.rowsExpected = rowsExpected;
}

6
spring-jms/src/main/java/org/springframework/jms/listener/adapter/JmsResponse.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -62,11 +62,11 @@ public class JmsResponse<T> { @@ -62,11 +62,11 @@ public class JmsResponse<T> {
/**
* Create a new {@link JmsResponse} instance.
* @param response the content of the result
* @param response the content of the response
* @param destination the destination
*/
protected JmsResponse(T response, Object destination) {
Assert.notNull(response, "Result must not be null");
Assert.notNull(response, "'response' must not be null");
this.response = response;
this.destination = destination;
}

4
spring-jms/src/main/java/org/springframework/jms/support/converter/MessagingMessageConverter.java

@ -70,8 +70,8 @@ public class MessagingMessageConverter implements MessageConverter, Initializing @@ -70,8 +70,8 @@ public class MessagingMessageConverter implements MessageConverter, Initializing
* header mapper.
*/
public MessagingMessageConverter(MessageConverter payloadConverter, JmsHeaderMapper headerMapper) {
Assert.notNull(payloadConverter, "PayloadConverter must not be null");
Assert.notNull(headerMapper, "HeaderMapper must not be null");
Assert.notNull(payloadConverter, "'payloadConverter' must not be null");
Assert.notNull(headerMapper, "'headerMapper' must not be null");
this.payloadConverter = payloadConverter;
this.headerMapper = headerMapper;
}

4
spring-r2dbc/src/main/java/org/springframework/r2dbc/core/binding/BindMarkersFactory.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -82,7 +82,7 @@ public interface BindMarkersFactory { @@ -82,7 +82,7 @@ public interface BindMarkersFactory {
* @see io.r2dbc.spi.Statement#bind(int, Object)
*/
static BindMarkersFactory anonymous(String placeholder) {
Assert.hasText(placeholder, "Placeholder must not be empty!");
Assert.hasText(placeholder, "Placeholder must not be empty");
return new BindMarkersFactory() {
@Override
public BindMarkers create() {

4
spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java

@ -41,7 +41,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie @@ -41,7 +41,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
*/
public MockClientHttpResponse(byte[] body, HttpStatusCode statusCode) {
super(body);
Assert.notNull(statusCode, "HttpStatusCode is required");
Assert.notNull(statusCode, "HttpStatusCode must not be null");
this.statusCode = statusCode;
}
@ -59,7 +59,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie @@ -59,7 +59,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
*/
public MockClientHttpResponse(InputStream body, HttpStatusCode statusCode) {
super(body);
Assert.notNull(statusCode, "HttpStatus is required");
Assert.notNull(statusCode, "HttpStatusCode must not be null");
this.statusCode = statusCode;
}

4
spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -61,7 +61,7 @@ public class MockClientHttpResponse implements ClientHttpResponse { @@ -61,7 +61,7 @@ public class MockClientHttpResponse implements ClientHttpResponse {
}
public MockClientHttpResponse(HttpStatusCode status) {
Assert.notNull(status, "HttpStatusCode is required");
Assert.notNull(status, "HttpStatusCode must not be null");
this.statusCode = status;
}

7
spring-web/src/main/java/org/springframework/http/ContentDisposition.java

@ -363,7 +363,7 @@ public final class ContentDisposition { @@ -363,7 +363,7 @@ public final class ContentDisposition {
if (idx1 != -1 && idx2 != -1) {
charset = Charset.forName(value.substring(0, idx1).trim());
Assert.isTrue(UTF_8.equals(charset) || ISO_8859_1.equals(charset),
"Charset should be UTF-8 or ISO-8859-1");
"Charset must be UTF-8 or ISO-8859-1");
filename = decodeFilename(value.substring(idx2 + 1), charset);
}
else {
@ -604,10 +604,11 @@ public final class ContentDisposition { @@ -604,10 +604,11 @@ public final class ContentDisposition {
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
*/
private static String encodeFilename(String input, Charset charset) {
Assert.notNull(input, "'input' is required");
Assert.notNull(charset, "'charset' is required");
Assert.notNull(input, "'input' must not be null");
Assert.notNull(charset, "'charset' must not be null");
Assert.isTrue(!StandardCharsets.US_ASCII.equals(charset), "ASCII does not require encoding");
Assert.isTrue(UTF_8.equals(charset) || ISO_8859_1.equals(charset), "Only UTF-8 and ISO-8859-1 are supported");
byte[] source = input.getBytes(charset);
int len = source.length;
StringBuilder sb = new StringBuilder(len << 1);

6
spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -117,9 +117,9 @@ public class HandshakeInfo { @@ -117,9 +117,9 @@ public class HandshakeInfo {
Assert.notNull(uri, "URI is required");
Assert.notNull(headers, "HttpHeaders are required");
Assert.notNull(cookies, "`cookies` are required");
Assert.notNull(cookies, "'cookies' are required");
Assert.notNull(principal, "Principal is required");
Assert.notNull(attributes, "'attributes' is required");
Assert.notNull(attributes, "'attributes' are required");
this.uri = uri;
this.headers = headers;

8
spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractWebSocketSession.java

@ -64,10 +64,10 @@ public abstract class AbstractWebSocketSession<T> implements WebSocketSession { @@ -64,10 +64,10 @@ public abstract class AbstractWebSocketSession<T> implements WebSocketSession {
* Create a new WebSocket session.
*/
protected AbstractWebSocketSession(T delegate, String id, HandshakeInfo info, DataBufferFactory bufferFactory) {
Assert.notNull(delegate, "Native session is required.");
Assert.notNull(id, "Session id is required.");
Assert.notNull(info, "HandshakeInfo is required.");
Assert.notNull(bufferFactory, "DataBuffer factory is required.");
Assert.notNull(delegate, "Native session is required");
Assert.notNull(id, "Session id is required");
Assert.notNull(info, "HandshakeInfo is required");
Assert.notNull(bufferFactory, "DataBuffer factory is required");
this.delegate = delegate;
this.id = id;

Loading…
Cancel
Save