Merge branch '5.1.x'

This commit is contained in:
Juergen Hoeller
2019-07-30 17:34:29 +02:00
16 changed files with 87 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -169,7 +169,7 @@ public class ResponseEntity<T> extends HttpEntity<T> {
@Override
public int hashCode() {
return (super.hashCode() * 29 + ObjectUtils.nullSafeHashCode(this.status));
return (29 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.status));
}
@Override

View File

@@ -108,7 +108,7 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
@Override
@Nullable
public HttpStatus getStatusCode() {
return this.statusCode != null ? HttpStatus.resolve(this.statusCode) : null;
return (this.statusCode != null ? HttpStatus.resolve(this.statusCode) : null);
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -19,7 +19,6 @@ package org.springframework.http.server.reactive;
import java.nio.file.Path;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.cookie.Cookie;
import io.netty.handler.codec.http.cookie.DefaultCookie;
import org.reactivestreams.Publisher;
@@ -62,14 +61,9 @@ class ReactorServerHttpResponse extends AbstractServerHttpResponse implements Ze
}
@Override
@SuppressWarnings("ConstantConditions")
public HttpStatus getStatusCode() {
HttpStatus httpStatus = super.getStatusCode();
if (httpStatus == null) {
HttpResponseStatus status = this.response.status();
httpStatus = status != null ? HttpStatus.resolve(status.code()) : null;
}
return httpStatus;
return (httpStatus != null ? httpStatus : HttpStatus.resolve(this.response.status().code()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -100,7 +100,7 @@ class ServletServerHttpResponse extends AbstractListenerServerHttpResponse {
@Override
public HttpStatus getStatusCode() {
HttpStatus httpStatus = super.getStatusCode();
return httpStatus != null ? httpStatus : HttpStatus.resolve(this.response.getStatus());
return (httpStatus != null ? httpStatus : HttpStatus.resolve(this.response.getStatus()));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -69,8 +69,7 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl
}
private static HttpHeaders createHeaders(HttpServerExchange exchange) {
UndertowHeadersAdapter headersMap =
new UndertowHeadersAdapter(exchange.getResponseHeaders());
UndertowHeadersAdapter headersMap = new UndertowHeadersAdapter(exchange.getResponseHeaders());
return new HttpHeaders(headersMap);
}
@@ -84,7 +83,7 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl
@Override
public HttpStatus getStatusCode() {
HttpStatus httpStatus = super.getStatusCode();
return httpStatus != null ? httpStatus : HttpStatus.resolve(this.exchange.getStatusCode());
return (httpStatus != null ? httpStatus : HttpStatus.resolve(this.exchange.getStatusCode()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -119,9 +119,8 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
if (resolver == null) {
throw new IllegalArgumentException(
"Unsupported parameter type [" + parameter.getParameterType().getName() + "]." +
" supportsParameter should be called first.");
throw new IllegalArgumentException("Unsupported parameter type [" +
parameter.getParameterType().getName() + "]. supportsParameter should be called first.");
}
return resolver.resolveArgument(parameter, mavContainer, webRequest, binderFactory);
}