Use consistent wording in precondition error messages
This commit is contained in:
parent
711a63adca
commit
2aa78889d2
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public RuntimeBeanReference(Class<?> beanType, boolean toParent) {
|
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.beanName = beanType.getName();
|
||||||
this.beanType = beanType;
|
this.beanType = beanType;
|
||||||
this.toParent = toParent;
|
this.toParent = toParent;
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setApplicationStartup(ApplicationStartup applicationStartup) {
|
public void setApplicationStartup(ApplicationStartup applicationStartup) {
|
||||||
Assert.notNull(applicationStartup, "applicationStartup should not be null");
|
Assert.notNull(applicationStartup, "applicationStartup must not be null");
|
||||||
this.applicationStartup = applicationStartup;
|
this.applicationStartup = applicationStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setApplicationStartup(ApplicationStartup applicationStartup) {
|
public void setApplicationStartup(ApplicationStartup applicationStartup) {
|
||||||
Assert.notNull(applicationStartup, "applicationStartup should not be null");
|
Assert.notNull(applicationStartup, "applicationStartup must not be null");
|
||||||
this.applicationStartup = applicationStartup;
|
this.applicationStartup = applicationStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class ScheduledAnnotationBeanPostProcessor
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar) {
|
public ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar) {
|
||||||
Assert.notNull(registrar, "ScheduledTaskRegistrar is required");
|
Assert.notNull(registrar, "ScheduledTaskRegistrar must not be null");
|
||||||
this.registrar = registrar;
|
this.registrar = registrar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ class InvocationsRecorderClassTransformer implements ClassFileTransformer {
|
||||||
private final String[] ignoredPackages;
|
private final String[] ignoredPackages;
|
||||||
|
|
||||||
public InvocationsRecorderClassTransformer(String[] instrumentedPackages, String[] ignoredPackages) {
|
public InvocationsRecorderClassTransformer(String[] instrumentedPackages, String[] ignoredPackages) {
|
||||||
Assert.notNull(instrumentedPackages, "instrumentedPackages should not be null");
|
Assert.notNull(instrumentedPackages, "instrumentedPackages must not be null");
|
||||||
Assert.notNull(ignoredPackages, "ignoredPackages should not be null");
|
Assert.notNull(ignoredPackages, "ignoredPackages must not be null");
|
||||||
this.instrumentedPackages = rewriteToAsmFormat(instrumentedPackages);
|
this.instrumentedPackages = rewriteToAsmFormat(instrumentedPackages);
|
||||||
this.ignoredPackages = rewriteToAsmFormat(ignoredPackages);
|
this.ignoredPackages = rewriteToAsmFormat(ignoredPackages);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* @throws AssertionError if any of the recorded invocations has no match in the provided hints
|
||||||
*/
|
*/
|
||||||
public void match(RuntimeHints runtimeHints) {
|
public void match(RuntimeHints runtimeHints) {
|
||||||
Assert.notNull(runtimeHints, "RuntimeHints should not be null");
|
Assert.notNull(runtimeHints, "RuntimeHints must not be null");
|
||||||
configureRuntimeHints(runtimeHints);
|
configureRuntimeHints(runtimeHints);
|
||||||
List<RecordedInvocation> noMatchInvocations =
|
List<RecordedInvocation> noMatchInvocations =
|
||||||
this.actual.recordedInvocations().filter(invocation -> !invocation.matches(runtimeHints)).toList();
|
this.actual.recordedInvocations().filter(invocation -> !invocation.matches(runtimeHints)).toList();
|
||||||
|
@ -84,7 +84,7 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListAssert<RecordedInvocation> notMatching(RuntimeHints runtimeHints) {
|
public ListAssert<RecordedInvocation> notMatching(RuntimeHints runtimeHints) {
|
||||||
Assert.notNull(runtimeHints, "RuntimeHints should not be null");
|
Assert.notNull(runtimeHints, "RuntimeHints must not be null");
|
||||||
configureRuntimeHints(runtimeHints);
|
configureRuntimeHints(runtimeHints);
|
||||||
return ListAssert.assertThatStream(this.actual.recordedInvocations()
|
return ListAssert.assertThatStream(this.actual.recordedInvocations()
|
||||||
.filter(invocation -> !invocation.matches(runtimeHints)));
|
.filter(invocation -> !invocation.matches(runtimeHints)));
|
||||||
|
|
|
@ -48,7 +48,7 @@ public final class RuntimeHintsRecorder {
|
||||||
* @return the recorded invocations
|
* @return the recorded invocations
|
||||||
*/
|
*/
|
||||||
public synchronized static RuntimeHintsInvocations record(Runnable action) {
|
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");
|
Assert.isTrue(RuntimeHintsAgent.isLoaded(), "RuntimeHintsAgent should be loaded in the current JVM");
|
||||||
RuntimeHintsRecorder recorder = new RuntimeHintsRecorder();
|
RuntimeHintsRecorder recorder = new RuntimeHintsRecorder();
|
||||||
RecordedInvocationsPublisher.addListener(recorder.listener);
|
RecordedInvocationsPublisher.addListener(recorder.listener);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class ReflectionHintsPredicates {
|
||||||
ReflectionHintsPredicates() {
|
ReflectionHintsPredicates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a predicate that checks whether a reflection hint is registered for the given type.
|
* 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.
|
* <p>The returned type exposes additional methods that refine the predicate behavior.
|
||||||
|
@ -58,7 +59,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the {@link RuntimeHints} predicate
|
* @return the {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public TypeHintPredicate onType(TypeReference typeReference) {
|
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);
|
return new TypeHintPredicate(typeReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the {@link RuntimeHints} predicate
|
* @return the {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public TypeHintPredicate onType(Class<?> type) {
|
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));
|
return new TypeHintPredicate(TypeReference.of(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the {@link RuntimeHints} predicate
|
* @return the {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public ConstructorHintPredicate onConstructor(Constructor<?> constructor) {
|
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);
|
return new ConstructorHintPredicate(constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the {@link RuntimeHints} predicate
|
* @return the {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public MethodHintPredicate onMethod(Method method) {
|
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);
|
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.
|
* @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) {
|
public MethodHintPredicate onMethod(Class<?> type, String methodName) {
|
||||||
Assert.notNull(type, "'type' should not be null");
|
Assert.notNull(type, "'type' must not be null");
|
||||||
Assert.hasText(methodName, "'methodName' should not be empty");
|
Assert.hasText(methodName, "'methodName' must not be empty");
|
||||||
return new MethodHintPredicate(getMethod(type, methodName));
|
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.
|
* @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 {
|
public MethodHintPredicate onMethod(String className, String methodName) throws ClassNotFoundException {
|
||||||
Assert.hasText(className, "'className' should not be empty");
|
Assert.hasText(className, "'className' must not be empty");
|
||||||
Assert.hasText(methodName, "'methodName' should not be empty");
|
Assert.hasText(methodName, "'methodName' must not be empty");
|
||||||
return onMethod(Class.forName(className), methodName);
|
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.
|
* @throws IllegalArgumentException if a field cannot be found with the given name.
|
||||||
*/
|
*/
|
||||||
public FieldHintPredicate onField(Class<?> type, String fieldName) {
|
public FieldHintPredicate onField(Class<?> type, String fieldName) {
|
||||||
Assert.notNull(type, "'type' should not be null");
|
Assert.notNull(type, "'type' must not be null");
|
||||||
Assert.hasText(fieldName, "'fieldName' should not be empty");
|
Assert.hasText(fieldName, "'fieldName' must not be empty");
|
||||||
Field field = ReflectionUtils.findField(type, fieldName);
|
Field field = ReflectionUtils.findField(type, fieldName);
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
throw new IllegalArgumentException("No field named '%s' on class %s".formatted(fieldName, type.getName()));
|
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.
|
* @throws IllegalArgumentException if a field cannot be found with the given name.
|
||||||
*/
|
*/
|
||||||
public FieldHintPredicate onField(String className, String fieldName) throws ClassNotFoundException {
|
public FieldHintPredicate onField(String className, String fieldName) throws ClassNotFoundException {
|
||||||
Assert.hasText(className, "'className' should not be empty");
|
Assert.hasText(className, "'className' must not be empty");
|
||||||
Assert.hasText(fieldName, "'fieldName' should not be empty");
|
Assert.hasText(fieldName, "'fieldName' must not be empty");
|
||||||
return onField(Class.forName(className), fieldName);
|
return onField(Class.forName(className), fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the {@link RuntimeHints} predicate
|
* @return the {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public FieldHintPredicate onField(Field field) {
|
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);
|
return new FieldHintPredicate(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +219,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the refined {@link RuntimeHints} predicate
|
* @return the refined {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public Predicate<RuntimeHints> withMemberCategory(MemberCategory memberCategory) {
|
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));
|
return this.and(hints -> getTypeHint(hints).getMemberCategories().contains(memberCategory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +229,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the refined {@link RuntimeHints} predicate
|
* @return the refined {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public Predicate<RuntimeHints> withMemberCategories(MemberCategory... memberCategories) {
|
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)));
|
return this.and(hints -> getTypeHint(hints).getMemberCategories().containsAll(Arrays.asList(memberCategories)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ public class ReflectionHintsPredicates {
|
||||||
* @return the refined {@link RuntimeHints} predicate
|
* @return the refined {@link RuntimeHints} predicate
|
||||||
*/
|
*/
|
||||||
public Predicate<RuntimeHints> withAnyMemberCategory(MemberCategory... memberCategories) {
|
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)
|
return this.and(hints -> Arrays.stream(memberCategories)
|
||||||
.anyMatch(memberCategory -> getTypeHint(hints).getMemberCategories().contains(memberCategory)));
|
.anyMatch(memberCategory -> getTypeHint(hints).getMemberCategories().contains(memberCategory)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class SerializationHintsPredicates {
|
||||||
SerializationHintsPredicates() {
|
SerializationHintsPredicates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a predicate that checks whether a {@link SerializationHints
|
* Return a predicate that checks whether a {@link SerializationHints
|
||||||
* serialization hint} is registered for the given type.
|
* serialization hint} is registered for the given type.
|
||||||
|
@ -43,7 +44,7 @@ public class SerializationHintsPredicates {
|
||||||
* @see java.lang.reflect.Proxy
|
* @see java.lang.reflect.Proxy
|
||||||
*/
|
*/
|
||||||
public Predicate<RuntimeHints> onType(Class<?> type) {
|
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));
|
return onType(TypeReference.of(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public class SerializationHintsPredicates {
|
||||||
* @see java.lang.reflect.Proxy
|
* @see java.lang.reflect.Proxy
|
||||||
*/
|
*/
|
||||||
public Predicate<RuntimeHints> onType(TypeReference typeReference) {
|
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(
|
return hints -> hints.serialization().javaSerializationHints().anyMatch(
|
||||||
hint -> hint.getType().equals(typeReference));
|
hint -> hint.getType().equals(typeReference));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -57,7 +57,7 @@ public interface Converter<S, T> {
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
default <U> Converter<S, U> andThen(Converter<? super T, ? extends U> after) {
|
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) -> {
|
return (S s) -> {
|
||||||
T initialResult = convert(s);
|
T initialResult = convert(s);
|
||||||
return (initialResult != null ? after.convert(initialResult) : null);
|
return (initialResult != null ? after.convert(initialResult) : null);
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||||
|
|
||||||
public ConversionServiceConverter(ConversionService conversionService, Class<? extends T> targetType) {
|
public ConversionServiceConverter(ConversionService conversionService, Class<? extends T> targetType) {
|
||||||
Assert.notNull(conversionService, "ConversionService must not be null");
|
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.conversionService = conversionService;
|
||||||
this.targetType = targetType;
|
this.targetType = targetType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public abstract class DataBufferUtils {
|
||||||
Callable<ReadableByteChannel> channelSupplier, DataBufferFactory bufferFactory, int bufferSize) {
|
Callable<ReadableByteChannel> channelSupplier, DataBufferFactory bufferFactory, int bufferSize) {
|
||||||
|
|
||||||
Assert.notNull(channelSupplier, "'channelSupplier' must not be null");
|
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");
|
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
|
||||||
|
|
||||||
return Flux.using(channelSupplier,
|
return Flux.using(channelSupplier,
|
||||||
|
@ -140,7 +140,7 @@ public abstract class DataBufferUtils {
|
||||||
DataBufferFactory bufferFactory, int bufferSize) {
|
DataBufferFactory bufferFactory, int bufferSize) {
|
||||||
|
|
||||||
Assert.notNull(channelSupplier, "'channelSupplier' must not be null");
|
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(position >= 0, "'position' must be >= 0");
|
||||||
Assert.isTrue(bufferSize > 0, "'bufferSize' 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) {
|
Path path, DataBufferFactory bufferFactory, int bufferSize, OpenOption... options) {
|
||||||
|
|
||||||
Assert.notNull(path, "Path must not be null");
|
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");
|
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
|
||||||
if (options.length > 0) {
|
if (options.length > 0) {
|
||||||
for (OpenOption option : options) {
|
for (OpenOption option : options) {
|
||||||
|
@ -420,7 +420,7 @@ public abstract class DataBufferUtils {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T extends DataBuffer> Flux<T> takeUntilByteCount(Publisher<T> publisher, long maxByteCount) {
|
public static <T extends DataBuffer> Flux<T> takeUntilByteCount(Publisher<T> publisher, long maxByteCount) {
|
||||||
Assert.notNull(publisher, "Publisher must not be null");
|
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(() -> {
|
return Flux.defer(() -> {
|
||||||
AtomicLong countDown = new AtomicLong(maxByteCount);
|
AtomicLong countDown = new AtomicLong(maxByteCount);
|
||||||
|
@ -453,7 +453,7 @@ public abstract class DataBufferUtils {
|
||||||
*/
|
*/
|
||||||
public static <T extends DataBuffer> Flux<T> skipUntilByteCount(Publisher<T> publisher, long maxByteCount) {
|
public static <T extends DataBuffer> Flux<T> skipUntilByteCount(Publisher<T> publisher, long maxByteCount) {
|
||||||
Assert.notNull(publisher, "Publisher must not be null");
|
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(() -> {
|
return Flux.defer(() -> {
|
||||||
AtomicLong countDown = new AtomicLong(maxByteCount);
|
AtomicLong countDown = new AtomicLong(maxByteCount);
|
||||||
|
@ -590,7 +590,7 @@ public abstract class DataBufferUtils {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public static Mono<DataBuffer> join(Publisher<? extends DataBuffer> buffers, int maxByteCount) {
|
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) {
|
if (buffers instanceof Mono mono) {
|
||||||
return mono;
|
return mono;
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public ResourceRegion(Resource resource, long position, long count) {
|
||||||
Assert.notNull(resource, "Resource must not be null");
|
Assert.notNull(resource, "Resource must not be null");
|
||||||
Assert.isTrue(position >= 0, "'position' 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 larger than or equal to 0");
|
Assert.isTrue(count >= 0, "'count' must be greater than or equal to 0");
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public AntPathMatcher(String pathSeparator) {
|
public AntPathMatcher(String pathSeparator) {
|
||||||
Assert.notNull(pathSeparator, "'pathSeparator' is required");
|
Assert.notNull(pathSeparator, "'pathSeparator' must not be null");
|
||||||
this.pathSeparator = pathSeparator;
|
this.pathSeparator = pathSeparator;
|
||||||
this.pathSeparatorPatternCache = new PathSeparatorPatternCache(pathSeparator);
|
this.pathSeparatorPatternCache = new PathSeparatorPatternCache(pathSeparator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple LRU (Least Recently Used) cache, bounded by a specified cache capacity.
|
* 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
|
* <p>This is a simplified, opinionated implementation of a LRU cache for internal
|
||||||
|
@ -81,7 +80,7 @@ public final class ConcurrentLruCache<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConcurrentLruCache(int capacity, Function<K, V> generator, int concurrencyLevel) {
|
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.capacity = capacity;
|
||||||
this.cache = new ConcurrentHashMap<>(16, 0.75f, concurrencyLevel);
|
this.cache = new ConcurrentHashMap<>(16, 0.75f, concurrencyLevel);
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
|
@ -106,8 +105,8 @@ public final class ConcurrentLruCache<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void put(K key, V value) {
|
private void put(K key, V value) {
|
||||||
Assert.notNull(key, "key should not be null");
|
Assert.notNull(key, "key must not be null");
|
||||||
Assert.notNull(value, "value should not be null");
|
Assert.notNull(value, "value must not be null");
|
||||||
final CacheEntry<V> cacheEntry = new CacheEntry<>(value, CacheEntryState.ACTIVE);
|
final CacheEntry<V> cacheEntry = new CacheEntry<>(value, CacheEntryState.ACTIVE);
|
||||||
final Node<K, V> node = new Node<>(key, cacheEntry);
|
final Node<K, V> node = new Node<>(key, cacheEntry);
|
||||||
final Node<K, V> prior = this.cache.putIfAbsent(node.key, node);
|
final Node<K, V> prior = this.cache.putIfAbsent(node.key, node);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class NullSafeComparator<T> implements Comparator<T> {
|
||||||
* @param nullsLow whether to treat nulls lower or higher than non-null objects
|
* @param nullsLow whether to treat nulls lower or higher than non-null objects
|
||||||
*/
|
*/
|
||||||
public NullSafeComparator(Comparator<T> comparator, boolean nullsLow) {
|
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.nonNullComparator = comparator;
|
||||||
this.nullsLow = nullsLow;
|
this.nullsLow = nullsLow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -49,7 +49,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespaceURI(String prefix) {
|
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)) {
|
if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
|
||||||
return XMLConstants.XML_NS_URI;
|
return XMLConstants.XML_NS_URI;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> getPrefixesSet(String namespaceUri) {
|
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)) {
|
if (this.defaultNamespaceUri.equals(namespaceUri)) {
|
||||||
return Collections.singleton(XMLConstants.DEFAULT_NS_PREFIX);
|
return Collections.singleton(XMLConstants.DEFAULT_NS_PREFIX);
|
||||||
}
|
}
|
||||||
|
@ -114,11 +114,11 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||||
/**
|
/**
|
||||||
* Bind the given prefix to the given namespace.
|
* Bind the given prefix to the given namespace.
|
||||||
* @param prefix the namespace prefix
|
* @param prefix the namespace prefix
|
||||||
* @param namespaceUri the namespace uri
|
* @param namespaceUri the namespace URI
|
||||||
*/
|
*/
|
||||||
public void bindNamespaceUri(String prefix, String namespaceUri) {
|
public void bindNamespaceUri(String prefix, String namespaceUri) {
|
||||||
Assert.notNull(prefix, "No prefix given");
|
Assert.notNull(prefix, "'prefix' must not be null");
|
||||||
Assert.notNull(namespaceUri, "No namespaceUri given");
|
Assert.notNull(namespaceUri, "'namespaceUri' must not be null");
|
||||||
if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
|
if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
|
||||||
this.defaultNamespaceUri = namespaceUri;
|
this.defaultNamespaceUri = namespaceUri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class SpelExpression implements Expression {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Object getValue(EvaluationContext context) throws EvaluationException {
|
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;
|
CompiledExpression compiledAst = this.compiledAst;
|
||||||
if (compiledAst != null) {
|
if (compiledAst != null) {
|
||||||
|
@ -279,7 +279,7 @@ public class SpelExpression implements Expression {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public <T> T getValue(EvaluationContext context, @Nullable Class<T> expectedResultType) throws EvaluationException {
|
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;
|
CompiledExpression compiledAst = this.compiledAst;
|
||||||
if (compiledAst != null) {
|
if (compiledAst != null) {
|
||||||
|
@ -314,7 +314,7 @@ public class SpelExpression implements Expression {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Object getValue(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException {
|
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;
|
CompiledExpression compiledAst = this.compiledAst;
|
||||||
if (compiledAst != null) {
|
if (compiledAst != null) {
|
||||||
|
@ -346,7 +346,7 @@ public class SpelExpression implements Expression {
|
||||||
public <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Class<T> expectedResultType)
|
public <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Class<T> expectedResultType)
|
||||||
throws EvaluationException {
|
throws EvaluationException {
|
||||||
|
|
||||||
Assert.notNull(context, "EvaluationContext is required");
|
Assert.notNull(context, "EvaluationContext must not be null");
|
||||||
|
|
||||||
CompiledExpression compiledAst = this.compiledAst;
|
CompiledExpression compiledAst = this.compiledAst;
|
||||||
if (compiledAst != null) {
|
if (compiledAst != null) {
|
||||||
|
@ -393,7 +393,7 @@ public class SpelExpression implements Expression {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Class<?> getValueType(EvaluationContext context) throws EvaluationException {
|
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);
|
ExpressionState expressionState = new ExpressionState(context, this.configuration);
|
||||||
TypeDescriptor typeDescriptor = this.ast.getValueInternal(expressionState).getTypeDescriptor();
|
TypeDescriptor typeDescriptor = this.ast.getValueInternal(expressionState).getTypeDescriptor();
|
||||||
return (typeDescriptor != null ? typeDescriptor.getType() : null);
|
return (typeDescriptor != null ? typeDescriptor.getType() : null);
|
||||||
|
@ -424,7 +424,7 @@ public class SpelExpression implements Expression {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException {
|
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);
|
ExpressionState expressionState = new ExpressionState(context, this.configuration);
|
||||||
return this.ast.getValueInternal(expressionState).getTypeDescriptor();
|
return this.ast.getValueInternal(expressionState).getTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ public class SpelExpression implements Expression {
|
||||||
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Object rootObject)
|
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Object rootObject)
|
||||||
throws EvaluationException {
|
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);
|
ExpressionState expressionState = new ExpressionState(context, toTypedValue(rootObject), this.configuration);
|
||||||
return this.ast.getValueInternal(expressionState).getTypeDescriptor();
|
return this.ast.getValueInternal(expressionState).getTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
@ -447,13 +447,13 @@ public class SpelExpression implements Expression {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWritable(EvaluationContext context) throws EvaluationException {
|
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));
|
return this.ast.isWritable(new ExpressionState(context, this.configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWritable(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException {
|
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));
|
return this.ast.isWritable(new ExpressionState(context, toTypedValue(rootObject), this.configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ public class SpelExpression implements Expression {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(EvaluationContext context, @Nullable Object value) throws EvaluationException {
|
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);
|
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)
|
public void setValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Object value)
|
||||||
throws EvaluationException {
|
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);
|
this.ast.setValue(new ExpressionState(context, toTypedValue(rootObject), this.configuration), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
||||||
* (just used for optimized collection handling)
|
* (just used for optimized collection handling)
|
||||||
*/
|
*/
|
||||||
public RowMapperResultSetExtractor(RowMapper<T> rowMapper, int rowsExpected) {
|
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.rowMapper = rowMapper;
|
||||||
this.rowsExpected = rowsExpected;
|
this.rowsExpected = rowsExpected;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -62,11 +62,11 @@ public class JmsResponse<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link JmsResponse} instance.
|
* Create a new {@link JmsResponse} instance.
|
||||||
* @param response the content of the result
|
* @param response the content of the response
|
||||||
* @param destination the destination
|
* @param destination the destination
|
||||||
*/
|
*/
|
||||||
protected JmsResponse(T response, Object 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.response = response;
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ public class MessagingMessageConverter implements MessageConverter, Initializing
|
||||||
* header mapper.
|
* header mapper.
|
||||||
*/
|
*/
|
||||||
public MessagingMessageConverter(MessageConverter payloadConverter, JmsHeaderMapper headerMapper) {
|
public MessagingMessageConverter(MessageConverter payloadConverter, JmsHeaderMapper headerMapper) {
|
||||||
Assert.notNull(payloadConverter, "PayloadConverter must not be null");
|
Assert.notNull(payloadConverter, "'payloadConverter' must not be null");
|
||||||
Assert.notNull(headerMapper, "HeaderMapper must not be null");
|
Assert.notNull(headerMapper, "'headerMapper' must not be null");
|
||||||
this.payloadConverter = payloadConverter;
|
this.payloadConverter = payloadConverter;
|
||||||
this.headerMapper = headerMapper;
|
this.headerMapper = headerMapper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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)
|
* @see io.r2dbc.spi.Statement#bind(int, Object)
|
||||||
*/
|
*/
|
||||||
static BindMarkersFactory anonymous(String placeholder) {
|
static BindMarkersFactory anonymous(String placeholder) {
|
||||||
Assert.hasText(placeholder, "Placeholder must not be empty!");
|
Assert.hasText(placeholder, "Placeholder must not be empty");
|
||||||
return new BindMarkersFactory() {
|
return new BindMarkersFactory() {
|
||||||
@Override
|
@Override
|
||||||
public BindMarkers create() {
|
public BindMarkers create() {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
|
||||||
*/
|
*/
|
||||||
public MockClientHttpResponse(byte[] body, HttpStatusCode statusCode) {
|
public MockClientHttpResponse(byte[] body, HttpStatusCode statusCode) {
|
||||||
super(body);
|
super(body);
|
||||||
Assert.notNull(statusCode, "HttpStatusCode is required");
|
Assert.notNull(statusCode, "HttpStatusCode must not be null");
|
||||||
this.statusCode = statusCode;
|
this.statusCode = statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
|
||||||
*/
|
*/
|
||||||
public MockClientHttpResponse(InputStream body, HttpStatusCode statusCode) {
|
public MockClientHttpResponse(InputStream body, HttpStatusCode statusCode) {
|
||||||
super(body);
|
super(body);
|
||||||
Assert.notNull(statusCode, "HttpStatus is required");
|
Assert.notNull(statusCode, "HttpStatusCode must not be null");
|
||||||
this.statusCode = statusCode;
|
this.statusCode = statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public MockClientHttpResponse(HttpStatusCode status) {
|
||||||
Assert.notNull(status, "HttpStatusCode is required");
|
Assert.notNull(status, "HttpStatusCode must not be null");
|
||||||
this.statusCode = status;
|
this.statusCode = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,7 @@ public final class ContentDisposition {
|
||||||
if (idx1 != -1 && idx2 != -1) {
|
if (idx1 != -1 && idx2 != -1) {
|
||||||
charset = Charset.forName(value.substring(0, idx1).trim());
|
charset = Charset.forName(value.substring(0, idx1).trim());
|
||||||
Assert.isTrue(UTF_8.equals(charset) || ISO_8859_1.equals(charset),
|
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);
|
filename = decodeFilename(value.substring(idx2 + 1), charset);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -604,10 +604,11 @@ public final class ContentDisposition {
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
|
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
|
||||||
*/
|
*/
|
||||||
private static String encodeFilename(String input, Charset charset) {
|
private static String encodeFilename(String input, Charset charset) {
|
||||||
Assert.notNull(input, "'input' is required");
|
Assert.notNull(input, "'input' must not be null");
|
||||||
Assert.notNull(charset, "'charset' is required");
|
Assert.notNull(charset, "'charset' must not be null");
|
||||||
Assert.isTrue(!StandardCharsets.US_ASCII.equals(charset), "ASCII does not require encoding");
|
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");
|
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);
|
byte[] source = input.getBytes(charset);
|
||||||
int len = source.length;
|
int len = source.length;
|
||||||
StringBuilder sb = new StringBuilder(len << 1);
|
StringBuilder sb = new StringBuilder(len << 1);
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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(uri, "URI is required");
|
||||||
Assert.notNull(headers, "HttpHeaders are 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(principal, "Principal is required");
|
||||||
Assert.notNull(attributes, "'attributes' is required");
|
Assert.notNull(attributes, "'attributes' are required");
|
||||||
|
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
this.headers = headers;
|
this.headers = headers;
|
||||||
|
|
|
@ -64,10 +64,10 @@ public abstract class AbstractWebSocketSession<T> implements WebSocketSession {
|
||||||
* Create a new WebSocket session.
|
* Create a new WebSocket session.
|
||||||
*/
|
*/
|
||||||
protected AbstractWebSocketSession(T delegate, String id, HandshakeInfo info, DataBufferFactory bufferFactory) {
|
protected AbstractWebSocketSession(T delegate, String id, HandshakeInfo info, DataBufferFactory bufferFactory) {
|
||||||
Assert.notNull(delegate, "Native session is required.");
|
Assert.notNull(delegate, "Native session is required");
|
||||||
Assert.notNull(id, "Session id is required.");
|
Assert.notNull(id, "Session id is required");
|
||||||
Assert.notNull(info, "HandshakeInfo is required.");
|
Assert.notNull(info, "HandshakeInfo is required");
|
||||||
Assert.notNull(bufferFactory, "DataBuffer factory is required.");
|
Assert.notNull(bufferFactory, "DataBuffer factory is required");
|
||||||
|
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
Loading…
Reference in New Issue