committed by
Sam Brannen
parent
487e14d549
commit
f8340838b3
@@ -172,7 +172,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
|
||||
|
||||
@Override
|
||||
protected <T> T getBean(Class<T> type) {
|
||||
Assert.state(this.beanFactory != null, "BeanFactory required for resolution of [" + type + "]");
|
||||
Assert.state(this.beanFactory != null, () -> "BeanFactory required for resolution of [" + type + "]");
|
||||
try {
|
||||
return this.beanFactory.getBean(type);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class NoOpCacheManager implements CacheManager {
|
||||
public Cache getCache(String name) {
|
||||
Cache cache = this.caches.get(name);
|
||||
if (cache == null) {
|
||||
this.caches.putIfAbsent(name, new NoOpCache(name));
|
||||
this.caches.computeIfAbsent(name, key -> new NoOpCache(name));
|
||||
synchronized (this.cacheNames) {
|
||||
this.cacheNames.add(name);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class DefaultMvcResult implements MvcResult {
|
||||
" was not set during the specified timeToWait=" + timeToWait);
|
||||
}
|
||||
Object result = this.asyncResult.get();
|
||||
Assert.state(result != RESULT_NONE, "Async result for handler [" + this.handler + "] was not set");
|
||||
Assert.state(result != RESULT_NONE, () -> "Async result for handler [" + this.handler + "] was not set");
|
||||
return this.asyncResult.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public interface ServerWebExchange {
|
||||
@SuppressWarnings("unchecked")
|
||||
default <T> T getRequiredAttribute(String name) {
|
||||
T value = getAttribute(name);
|
||||
Assert.notNull(value, "Required attribute '" + name + "' is missing.");
|
||||
Assert.notNull(value, () -> "Required attribute '" + name + "' is missing.");
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public interface WebSession {
|
||||
@SuppressWarnings("unchecked")
|
||||
default <T> T getRequiredAttribute(String name) {
|
||||
T value = getAttribute(name);
|
||||
Assert.notNull(value, "Required attribute '" + name + "' is missing.");
|
||||
Assert.notNull(value, () -> "Required attribute '" + name + "' is missing.");
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class ExchangeFilterFunctions {
|
||||
return ExchangeFilterFunction.ofRequestProcessor(request ->
|
||||
credentialsFunction.apply(request)
|
||||
.map(credentials -> Mono.just(insertAuthorizationHeader(request, credentials)))
|
||||
.orElse(Mono.just(request)));
|
||||
.orElseGet(() -> Mono.just(request)));
|
||||
}
|
||||
|
||||
private static void checkIllegalCharacters(String username, String password) {
|
||||
|
||||
@@ -139,7 +139,7 @@ class ModelInitializer {
|
||||
.ofNullable(AnnotatedElementUtils.findMergedAnnotation(param.getAnnotatedElement(), ModelAttribute.class))
|
||||
.filter(ann -> StringUtils.hasText(ann.value()))
|
||||
.map(ModelAttribute::value)
|
||||
.orElse(Conventions.getVariableNameForParameter(param));
|
||||
.orElseGet(() -> Conventions.getVariableNameForParameter(param));
|
||||
}
|
||||
|
||||
/** Find {@code @ModelAttribute} arguments also listed as {@code @SessionAttributes}. */
|
||||
|
||||
@@ -244,7 +244,7 @@ public class RedirectView extends AbstractUrlBasedView {
|
||||
while (found) {
|
||||
String name = matcher.group(1);
|
||||
Object value = (model.containsKey(name) ? model.get(name) : uriVariables.get(name));
|
||||
Assert.notNull(value, "No value for URI variable '" + name + "'");
|
||||
Assert.notNull(value, () -> "No value for URI variable '" + name + "'");
|
||||
result.append(targetUrl.substring(endLastMatch, matcher.start()));
|
||||
result.append(encodeUriVariable(value.toString()));
|
||||
endLastMatch = matcher.end();
|
||||
|
||||
@@ -286,7 +286,7 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
|
||||
return Optional.ofNullable(returnType.getMethodAnnotation(ModelAttribute.class))
|
||||
.filter(ann -> StringUtils.hasText(ann.value()))
|
||||
.map(ModelAttribute::value)
|
||||
.orElse(Conventions.getVariableNameForParameter(returnType));
|
||||
.orElseGet(() -> Conventions.getVariableNameForParameter(returnType));
|
||||
}
|
||||
|
||||
private void updateBindingContext(BindingContext context, ServerWebExchange exchange) {
|
||||
|
||||
@@ -120,7 +120,7 @@ class ReactiveTypeHandler {
|
||||
|
||||
Assert.notNull(returnValue, "Expected return value");
|
||||
ReactiveAdapter adapter = this.reactiveRegistry.getAdapter(returnValue.getClass());
|
||||
Assert.state(adapter != null, "Unexpected return value: " + returnValue);
|
||||
Assert.state(adapter != null, () -> "Unexpected return value: " + returnValue);
|
||||
|
||||
ResolvableType elementType = ResolvableType.forMethodParameter(returnType).getGeneric();
|
||||
Class<?> elementClass = elementType.toClass();
|
||||
|
||||
@@ -159,7 +159,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
||||
List<String> paths = Arrays.asList(StringUtils.tokenizeToStringArray(pathAttribute, ","));
|
||||
for (String path : paths) {
|
||||
path = path.trim();
|
||||
Assert.state(StringUtils.hasText(path), "Invalid <stomp-endpoint> path attribute: " + pathAttribute);
|
||||
Assert.state(StringUtils.hasText(path), () -> "Invalid <stomp-endpoint> path attribute: " + pathAttribute);
|
||||
if (DomUtils.getChildElementByTagName(endpointElem, "sockjs") != null) {
|
||||
path = path.endsWith("/") ? path + "**" : path + "/**";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user