diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java index a414c3e782..fbb748ad3c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java @@ -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 { * @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; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java index 509ef10f06..a8bcb4a09d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java @@ -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; } diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index 60978c2aa5..5440349021 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java @@ -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; } diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java index facf5323d0..5b3426f6cf 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java @@ -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; } diff --git a/spring-core-test/src/main/java/org/springframework/aot/agent/InvocationsRecorderClassTransformer.java b/spring-core-test/src/main/java/org/springframework/aot/agent/InvocationsRecorderClassTransformer.java index 8e9b4a2a24..f9cc6abd17 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/agent/InvocationsRecorderClassTransformer.java +++ b/spring-core-test/src/main/java/org/springframework/aot/agent/InvocationsRecorderClassTransformer.java @@ -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); } diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java index 0d0b52eced..34eea845d5 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java +++ b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java @@ -74,7 +74,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert noMatchInvocations = this.actual.recordedInvocations().filter(invocation -> !invocation.matches(runtimeHints)).toList(); @@ -84,7 +84,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert 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))); diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsRecorder.java b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsRecorder.java index abad3a8552..a9471a4c5d 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsRecorder.java +++ b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsRecorder.java @@ -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); diff --git a/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java b/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java index 2de9a41182..31c66348f8 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java @@ -51,6 +51,7 @@ public class ReflectionHintsPredicates { ReflectionHintsPredicates() { } + /** * Return a predicate that checks whether a reflection hint is registered for the given type. *

The returned type exposes additional methods that refine the predicate behavior. @@ -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 { * @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 { * @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 { * @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 { * @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 { * @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 { * @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 { * @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 { * @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 { * @return the refined {@link RuntimeHints} predicate */ public Predicate 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 { * @return the refined {@link RuntimeHints} predicate */ public Predicate 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 { * @return the refined {@link RuntimeHints} predicate */ public Predicate 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))); } diff --git a/spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java b/spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java index 833937aed5..5761313027 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java @@ -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 { * @see java.lang.reflect.Proxy */ public Predicate 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 { * @see java.lang.reflect.Proxy */ public Predicate 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)); } diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java index c1bc0d2131..b603fdc28b 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java @@ -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 { * @since 5.3 */ default Converter andThen(Converter 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); diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java b/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java index 7ecd15661e..a313a7938a 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java @@ -114,7 +114,7 @@ public class ConvertingComparator implements Comparator { public ConversionServiceConverter(ConversionService conversionService, Class 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; } diff --git a/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java b/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java index 8ad237c7f3..d255f1e281 100644 --- a/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java @@ -100,7 +100,7 @@ public abstract class DataBufferUtils { Callable 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 { 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 { 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 { @SuppressWarnings("unchecked") public static Flux takeUntilByteCount(Publisher 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 { */ public static Flux skipUntilByteCount(Publisher 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 { */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static Mono join(Publisher 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; diff --git a/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java b/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java index dfa7b67938..cd1cad5a04 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java @@ -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 { */ 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; diff --git a/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java b/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java index ec520d3fa1..9eb2c91c65 100644 --- a/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java +++ b/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java @@ -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); } diff --git a/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java b/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java index 4104ccbf51..2e5f19e176 100644 --- a/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java +++ b/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java @@ -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. *

This is a simplified, opinionated implementation of a LRU cache for internal @@ -81,7 +80,7 @@ public final class ConcurrentLruCache { } private ConcurrentLruCache(int capacity, Function 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 { } 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 cacheEntry = new CacheEntry<>(value, CacheEntryState.ACTIVE); final Node node = new Node<>(key, cacheEntry); final Node prior = this.cache.putIfAbsent(node.key, node); diff --git a/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java b/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java index 50e4745e06..ddedb43094 100644 --- a/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java +++ b/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java @@ -85,7 +85,7 @@ public class NullSafeComparator implements Comparator { * @param nullsLow whether to treat nulls lower or higher than non-null objects */ public NullSafeComparator(Comparator 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; } diff --git a/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java b/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java index 05a0408b72..b895a4edb3 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java +++ b/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java @@ -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 { @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 { } private Set 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 { /** * 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; } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java index 660fb23ddc..f4ea32211f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java @@ -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 { @Override @Nullable public T getValue(EvaluationContext context, @Nullable Class 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 { @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 { public T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Class 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 { @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 { @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 { 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 { @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 { @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 { 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); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java index 25cbddcb11..70eb055bf5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java @@ -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 implements ResultSetExtractor rowMapper, int rowsExpected) { - Assert.notNull(rowMapper, "RowMapper is required"); + Assert.notNull(rowMapper, "RowMapper must not be null"); this.rowMapper = rowMapper; this.rowsExpected = rowsExpected; } diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/JmsResponse.java b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/JmsResponse.java index 2fdaca1384..caa6b4b573 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/JmsResponse.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/JmsResponse.java @@ -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 { /** * 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; } diff --git a/spring-jms/src/main/java/org/springframework/jms/support/converter/MessagingMessageConverter.java b/spring-jms/src/main/java/org/springframework/jms/support/converter/MessagingMessageConverter.java index 70daf59e49..35fb73b198 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/converter/MessagingMessageConverter.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/converter/MessagingMessageConverter.java @@ -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; } diff --git a/spring-r2dbc/src/main/java/org/springframework/r2dbc/core/binding/BindMarkersFactory.java b/spring-r2dbc/src/main/java/org/springframework/r2dbc/core/binding/BindMarkersFactory.java index 90cff2a4eb..c77999bdbf 100644 --- a/spring-r2dbc/src/main/java/org/springframework/r2dbc/core/binding/BindMarkersFactory.java +++ b/spring-r2dbc/src/main/java/org/springframework/r2dbc/core/binding/BindMarkersFactory.java @@ -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 { * @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() { diff --git a/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java b/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java index b8a5d084c1..6886c99fb3 100644 --- a/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java @@ -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 */ 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; } diff --git a/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java b/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java index 362f8c9c91..fddc2687c4 100644 --- a/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java @@ -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 { } public MockClientHttpResponse(HttpStatusCode status) { - Assert.notNull(status, "HttpStatusCode is required"); + Assert.notNull(status, "HttpStatusCode must not be null"); this.statusCode = status; } diff --git a/spring-web/src/main/java/org/springframework/http/ContentDisposition.java b/spring-web/src/main/java/org/springframework/http/ContentDisposition.java index 8d9dcd2fc4..6cc33fe8de 100644 --- a/spring-web/src/main/java/org/springframework/http/ContentDisposition.java +++ b/spring-web/src/main/java/org/springframework/http/ContentDisposition.java @@ -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 { * @see RFC 5987 */ 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); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java index 0bef75a832..a12a667a31 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java @@ -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 { 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; diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractWebSocketSession.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractWebSocketSession.java index 68a2680627..6d04480e3e 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractWebSocketSession.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractWebSocketSession.java @@ -64,10 +64,10 @@ public abstract class AbstractWebSocketSession 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;