parent
99ae209c25
commit
50109dd86d
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -158,10 +158,7 @@ public class HttpComponentsClientHttpConnector implements ClientHttpConnector, C
|
|||
|
||||
@Override
|
||||
public void failed(Exception ex) {
|
||||
Throwable t = ex;
|
||||
if (t instanceof HttpStreamResetException hsre) {
|
||||
t = hsre.getCause();
|
||||
}
|
||||
Throwable t = (ex instanceof HttpStreamResetException hsre ? hsre.getCause() : ex);
|
||||
this.sink.error(t);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -131,9 +131,9 @@ public class JettyResourceFactory implements InitializingBean, DisposableBean {
|
|||
}
|
||||
if (this.byteBufferPool == null) {
|
||||
this.byteBufferPool = new MappedByteBufferPool(2048,
|
||||
this.executor instanceof ThreadPool.SizedThreadPool sizedThreadPool
|
||||
? sizedThreadPool.getMaxThreads() / 2
|
||||
: ProcessorUtils.availableProcessors() * 2);
|
||||
this.executor instanceof ThreadPool.SizedThreadPool sizedThreadPool ?
|
||||
sizedThreadPool.getMaxThreads() / 2 :
|
||||
ProcessorUtils.availableProcessors() * 2);
|
||||
}
|
||||
if (this.scheduler == null) {
|
||||
this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false);
|
||||
|
|
|
@ -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.
|
||||
|
@ -163,8 +163,8 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
|
|||
protected Map<String, Object> getReadHints(ResolvableType actualType,
|
||||
ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response) {
|
||||
|
||||
if (this.decoder instanceof HttpMessageDecoder<?> httpMethodDecoder) {
|
||||
return httpMethodDecoder.getDecodeHints(actualType, elementType, request, response);
|
||||
if (this.decoder instanceof HttpMessageDecoder<?> httpMessageDecoder) {
|
||||
return httpMessageDecoder.getDecodeHints(actualType, elementType, request, response);
|
||||
}
|
||||
return Hints.none();
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -150,9 +150,9 @@ public class ServerSentEventHttpMessageWriter implements HttpMessageWriter<Objec
|
|||
if (data == null) {
|
||||
result = Flux.just(encodeText(sb + "\n", mediaType, factory));
|
||||
}
|
||||
else if (data instanceof String dataString) {
|
||||
dataString = StringUtils.replace(dataString, "\n", "\ndata:");
|
||||
result = Flux.just(encodeText(sb + dataString + "\n\n", mediaType, factory));
|
||||
else if (data instanceof String text) {
|
||||
text = StringUtils.replace(text, "\n", "\ndata:");
|
||||
result = Flux.just(encodeText(sb + text + "\n\n", mediaType, factory));
|
||||
}
|
||||
else {
|
||||
result = encodeEvent(sb, data, dataType, mediaType, factory, hints);
|
||||
|
|
|
@ -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.
|
||||
|
@ -129,7 +129,7 @@ public class MultipartHttpMessageReader extends LoggingCodecSupport
|
|||
}
|
||||
|
||||
private List<Part> toList(Collection<Part> collection) {
|
||||
return collection instanceof List<Part> partList ? partList : new ArrayList<>(collection);
|
||||
return (collection instanceof List<Part> list ? list : new ArrayList<>(collection));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -441,24 +441,26 @@ class BaseDefaultCodecs implements CodecConfigurer.DefaultCodecs, CodecConfigure
|
|||
if (codec instanceof AbstractDataBufferDecoder<?> abstractDataBufferDecoder) {
|
||||
abstractDataBufferDecoder.setMaxInMemorySize(size);
|
||||
}
|
||||
// Pattern variables in the following if-blocks cannot be named the same as instance fields
|
||||
// due to lacking support in Checkstyle: https://github.com/checkstyle/checkstyle/issues/10969
|
||||
if (protobufPresent) {
|
||||
if (codec instanceof ProtobufDecoder protobufDecoderCodec) {
|
||||
protobufDecoderCodec.setMaxMessageSize(size);
|
||||
if (codec instanceof ProtobufDecoder protobufDec) {
|
||||
protobufDec.setMaxMessageSize(size);
|
||||
}
|
||||
}
|
||||
if (kotlinSerializationCborPresent) {
|
||||
if (codec instanceof KotlinSerializationCborDecoder kotlinSerializationCborDecoderCodec) {
|
||||
kotlinSerializationCborDecoderCodec.setMaxInMemorySize(size);
|
||||
if (codec instanceof KotlinSerializationCborDecoder kotlinSerializationCborDec) {
|
||||
kotlinSerializationCborDec.setMaxInMemorySize(size);
|
||||
}
|
||||
}
|
||||
if (kotlinSerializationJsonPresent) {
|
||||
if (codec instanceof KotlinSerializationJsonDecoder kotlinSerializationJsonDecoderCodec) {
|
||||
kotlinSerializationJsonDecoderCodec.setMaxInMemorySize(size);
|
||||
if (codec instanceof KotlinSerializationJsonDecoder kotlinSerializationJsonDec) {
|
||||
kotlinSerializationJsonDec.setMaxInMemorySize(size);
|
||||
}
|
||||
}
|
||||
if (kotlinSerializationProtobufPresent) {
|
||||
if (codec instanceof KotlinSerializationProtobufDecoder kotlinSerializationProtobufDecoderCodec) {
|
||||
kotlinSerializationProtobufDecoderCodec.setMaxInMemorySize(size);
|
||||
if (codec instanceof KotlinSerializationProtobufDecoder kotlinSerializationProtobufDec) {
|
||||
kotlinSerializationProtobufDec.setMaxInMemorySize(size);
|
||||
}
|
||||
}
|
||||
if (jackson2Present) {
|
||||
|
|
|
@ -69,8 +69,10 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
|
|||
public MarshallingHttpMessageConverter(Marshaller marshaller) {
|
||||
Assert.notNull(marshaller, "Marshaller must not be null");
|
||||
this.marshaller = marshaller;
|
||||
if (marshaller instanceof Unmarshaller um) {
|
||||
this.unmarshaller = um;
|
||||
// The following pattern variable cannot be named "unmarshaller" due to lacking
|
||||
// support in Checkstyle: https://github.com/checkstyle/checkstyle/issues/10969
|
||||
if (marshaller instanceof Unmarshaller _unmarshaller) {
|
||||
this.unmarshaller = _unmarshaller;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -180,8 +180,8 @@ public class ContentNegotiationManager implements ContentNegotiationStrategy, Me
|
|||
public Map<String, MediaType> getMediaTypeMappings() {
|
||||
Map<String, MediaType> result = null;
|
||||
for (MediaTypeFileExtensionResolver resolver : this.resolvers) {
|
||||
if (resolver instanceof MappingMediaTypeFileExtensionResolver mappingMediaTypeFileExtensionResolver) {
|
||||
Map<String, MediaType> map = mappingMediaTypeFileExtensionResolver.getMediaTypes();
|
||||
if (resolver instanceof MappingMediaTypeFileExtensionResolver mappingResolver) {
|
||||
Map<String, MediaType> map = mappingResolver.getMediaTypes();
|
||||
if (CollectionUtils.isEmpty(map)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -321,8 +321,8 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||
* @since 4.3
|
||||
*/
|
||||
public void setDefaultUriVariables(Map<String, ?> uriVars) {
|
||||
if (this.uriTemplateHandler instanceof DefaultUriBuilderFactory defaultUriVariables) {
|
||||
defaultUriVariables.setDefaultUriVariables(uriVars);
|
||||
if (this.uriTemplateHandler instanceof DefaultUriBuilderFactory factory) {
|
||||
factory.setDefaultUriVariables(uriVars);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException(
|
||||
|
@ -1002,7 +1002,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||
}
|
||||
|
||||
private boolean canReadResponse(Type responseType, HttpMessageConverter<?> converter) {
|
||||
Class<?> responseClass = (responseType instanceof Class<?> type ? type : null);
|
||||
Class<?> responseClass = (responseType instanceof Class<?> clazz ? clazz : null);
|
||||
if (responseClass != null) {
|
||||
return converter.canRead(responseClass, null);
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void doWithRequest(ClientHttpRequest httpRequest) throws IOException {
|
||||
super.doWithRequest(httpRequest);
|
||||
Object requestBody = this.requestEntity.getBody();
|
||||
|
@ -1068,15 +1068,15 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||
}
|
||||
else {
|
||||
Class<?> requestBodyClass = requestBody.getClass();
|
||||
Type requestBodyType = (this.requestEntity instanceof RequestEntity<?> re ?
|
||||
re.getType() : requestBodyClass);
|
||||
// The following pattern variable cannot be named "requestEntity" due to lacking
|
||||
// support in Checkstyle: https://github.com/checkstyle/checkstyle/issues/10969
|
||||
Type requestBodyType = (this.requestEntity instanceof RequestEntity<?> _requestEntity ?
|
||||
_requestEntity.getType() : requestBodyClass);
|
||||
HttpHeaders httpHeaders = httpRequest.getHeaders();
|
||||
HttpHeaders requestHeaders = this.requestEntity.getHeaders();
|
||||
MediaType requestContentType = requestHeaders.getContentType();
|
||||
for (HttpMessageConverter<?> messageConverter : getMessageConverters()) {
|
||||
if (messageConverter instanceof GenericHttpMessageConverter) {
|
||||
GenericHttpMessageConverter<Object> genericConverter =
|
||||
(GenericHttpMessageConverter<Object>) messageConverter;
|
||||
if (messageConverter instanceof GenericHttpMessageConverter genericConverter) {
|
||||
if (genericConverter.canWrite(requestBodyType, requestBodyClass, requestContentType)) {
|
||||
if (!requestHeaders.isEmpty()) {
|
||||
requestHeaders.forEach((key, values) -> httpHeaders.put(key, new ArrayList<>(values)));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -114,14 +114,14 @@ public abstract class WebApplicationContextUtils {
|
|||
if (attr == null) {
|
||||
return null;
|
||||
}
|
||||
if (attr instanceof RuntimeException re) {
|
||||
throw re;
|
||||
if (attr instanceof RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
if (attr instanceof Error error) {
|
||||
throw error;
|
||||
}
|
||||
if (attr instanceof Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
if (attr instanceof Exception exception) {
|
||||
throw new IllegalStateException(exception);
|
||||
}
|
||||
if (!(attr instanceof WebApplicationContext wac)) {
|
||||
throw new IllegalStateException("Context attribute is not of type WebApplicationContext: " + attr);
|
||||
|
@ -152,12 +152,12 @@ public abstract class WebApplicationContextUtils {
|
|||
while (attrNames.hasMoreElements()) {
|
||||
String attrName = attrNames.nextElement();
|
||||
Object attrValue = sc.getAttribute(attrName);
|
||||
if (attrValue instanceof WebApplicationContext) {
|
||||
if (attrValue instanceof WebApplicationContext currentWac) {
|
||||
if (wac != null) {
|
||||
throw new IllegalStateException("No unique WebApplicationContext found: more than one " +
|
||||
"DispatcherServlet registered with publishContext=true?");
|
||||
}
|
||||
wac = (WebApplicationContext) attrValue;
|
||||
wac = currentWac;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
|
@ -55,8 +55,8 @@ public abstract class FacesContextUtils {
|
|||
if (attr == null) {
|
||||
return null;
|
||||
}
|
||||
if (attr instanceof RuntimeException re) {
|
||||
throw re;
|
||||
if (attr instanceof RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
if (attr instanceof Error error) {
|
||||
throw error;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -65,8 +65,8 @@ public class MapMethodProcessor implements HandlerMethodArgumentResolver, Handle
|
|||
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
|
||||
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
|
||||
|
||||
if (returnValue instanceof Map returnValueMap) {
|
||||
mavContainer.addAllAttributes(returnValueMap);
|
||||
if (returnValue instanceof Map map) {
|
||||
mavContainer.addAllAttributes(map);
|
||||
}
|
||||
else if (returnValue != null) {
|
||||
// should not happen
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -234,8 +234,8 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod
|
|||
Assert.state(name != null, "Unresolvable parameter name");
|
||||
|
||||
parameter = parameter.nestedIfOptional();
|
||||
if (value instanceof Optional<?> optionalValue) {
|
||||
value = optionalValue.orElse(null);
|
||||
if (value instanceof Optional<?> optional) {
|
||||
value = optional.orElse(null);
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
|
@ -245,8 +245,8 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod
|
|||
}
|
||||
builder.queryParam(name);
|
||||
}
|
||||
else if (value instanceof Collection<?> collectionValue) {
|
||||
for (Object element : collectionValue) {
|
||||
else if (value instanceof Collection<?> elements) {
|
||||
for (Object element : elements) {
|
||||
element = formatUriValue(conversionService, TypeDescriptor.nested(parameter, 1), element);
|
||||
builder.queryParam(name, element);
|
||||
}
|
||||
|
@ -263,8 +263,8 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod
|
|||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
else if (value instanceof String stringValue) {
|
||||
return stringValue;
|
||||
else if (value instanceof String string) {
|
||||
return string;
|
||||
}
|
||||
else if (cs != null) {
|
||||
return (String) cs.convert(value, sourceType, STRING_TYPE_DESCRIPTOR);
|
||||
|
|
|
@ -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.
|
||||
|
@ -94,8 +94,8 @@ public class HandlerMethodReturnValueHandlerComposite implements HandlerMethodRe
|
|||
|
||||
private boolean isAsyncReturnValue(@Nullable Object value, MethodParameter returnType) {
|
||||
for (HandlerMethodReturnValueHandler handler : this.returnValueHandlers) {
|
||||
if (handler instanceof AsyncHandlerMethodReturnValueHandler asyncHandlerMethodReturnValueHandler &&
|
||||
asyncHandlerMethodReturnValueHandler.isAsyncReturnValue(value, returnType)) {
|
||||
if (handler instanceof AsyncHandlerMethodReturnValueHandler asyncHandler &&
|
||||
asyncHandler.isAsyncReturnValue(value, returnType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -208,15 +208,15 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
|||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
assertTargetBean(method, getBean(), args);
|
||||
String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException)
|
||||
? "Illegal argument": ex.getMessage();
|
||||
String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException) ?
|
||||
"Illegal argument" : ex.getMessage();
|
||||
throw new IllegalStateException(formatInvokeError(text, args), ex);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
// Unwrap for HandlerExceptionResolvers ...
|
||||
Throwable targetException = ex.getTargetException();
|
||||
if (targetException instanceof RuntimeException re) {
|
||||
throw re;
|
||||
Throwable targetException = ex.getCause();
|
||||
if (targetException instanceof RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
else if (targetException instanceof Error error) {
|
||||
throw error;
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.springframework.web.bind.support.SimpleSessionStatus;
|
|||
* <p>A default {@link Model} is automatically created at instantiation.
|
||||
* An alternate model instance may be provided via {@link #setRedirectModel}
|
||||
* for use in a redirect scenario. When {@link #setRedirectModelScenario} is set
|
||||
* to {@code true} signalling a redirect scenario, the {@link #getModel()}
|
||||
* to {@code true} signaling a redirect scenario, the {@link #getModel()}
|
||||
* returns the redirect model instead of the default model.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
|
@ -106,7 +106,7 @@ public class ModelAndViewContainer {
|
|||
*/
|
||||
@Nullable
|
||||
public String getViewName() {
|
||||
return (this.view instanceof String stringView ? stringView : null);
|
||||
return (this.view instanceof String viewName ? viewName : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
@ -88,9 +88,9 @@ class MultipartFileResource extends AbstractResource {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof MultipartFileResource multipartFileResource &&
|
||||
multipartFileResource.multipartFile.equals(this.multipartFile)));
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return (this == obj || (obj instanceof MultipartFileResource other &&
|
||||
this.multipartFile.equals(other.multipartFile)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -726,8 +726,8 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
|
|||
@Nullable
|
||||
private String getQueryParamValue(@Nullable Object value) {
|
||||
if (value != null) {
|
||||
return (value instanceof Optional<?> optionalValue ?
|
||||
optionalValue.map(Object::toString).orElse(null) :
|
||||
return (value instanceof Optional<?> optional ?
|
||||
optional.map(Object::toString).orElse(null) :
|
||||
value.toString());
|
||||
}
|
||||
return null;
|
||||
|
@ -740,12 +740,12 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
|
|||
|
||||
@Override
|
||||
public UriComponentsBuilder queryParamIfPresent(String name, Optional<?> value) {
|
||||
value.ifPresent(o -> {
|
||||
if (o instanceof Collection<?> elements) {
|
||||
queryParam(name, elements);
|
||||
value.ifPresent(v -> {
|
||||
if (v instanceof Collection<?> values) {
|
||||
queryParam(name, values);
|
||||
}
|
||||
else {
|
||||
queryParam(name, o);
|
||||
queryParam(name, v);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue