Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
This commit is contained in:
@@ -54,7 +54,7 @@ public class HandlerExecutionChain {
|
||||
* Create a new HandlerExecutionChain.
|
||||
* @param handler the handler object to execute
|
||||
*/
|
||||
public HandlerExecutionChain(Object handler) {
|
||||
public HandlerExecutionChain(@Nullable Object handler) {
|
||||
this(handler, (HandlerInterceptor[]) null);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class HandlerExecutionChain {
|
||||
* @param interceptors the array of interceptors to apply
|
||||
* (in the given order) before the handler itself executes
|
||||
*/
|
||||
public HandlerExecutionChain(Object handler, HandlerInterceptor... interceptors) {
|
||||
public HandlerExecutionChain(@Nullable Object handler, HandlerInterceptor... interceptors) {
|
||||
if (handler instanceof HandlerExecutionChain) {
|
||||
HandlerExecutionChain originalChain = (HandlerExecutionChain) handler;
|
||||
this.handler = originalChain.getHandler();
|
||||
|
||||
@@ -71,9 +71,9 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
private final RequestConditionHolder customConditionHolder;
|
||||
|
||||
|
||||
public RequestMappingInfo(String name, PatternsRequestCondition patterns, RequestMethodsRequestCondition methods,
|
||||
ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes,
|
||||
ProducesRequestCondition produces, RequestCondition<?> custom) {
|
||||
public RequestMappingInfo(@Nullable String name, @Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods,
|
||||
@Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
|
||||
@Nullable ProducesRequestCondition produces, @Nullable RequestCondition<?> custom) {
|
||||
|
||||
this.name = (StringUtils.hasText(name) ? name : null);
|
||||
this.patternsCondition = (patterns != null ? patterns : new PatternsRequestCondition());
|
||||
@@ -88,9 +88,9 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
/**
|
||||
* Creates a new instance with the given request conditions.
|
||||
*/
|
||||
public RequestMappingInfo(PatternsRequestCondition patterns, RequestMethodsRequestCondition methods,
|
||||
ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes,
|
||||
ProducesRequestCondition produces, RequestCondition<?> custom) {
|
||||
public RequestMappingInfo(@Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods,
|
||||
@Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
|
||||
@Nullable ProducesRequestCondition produces, @Nullable RequestCondition<?> custom) {
|
||||
|
||||
this(null, patterns, methods, params, headers, consumes, produces, custom);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
/**
|
||||
* Re-create a RequestMappingInfo with the given custom request condition.
|
||||
*/
|
||||
public RequestMappingInfo(RequestMappingInfo info, RequestCondition<?> customRequestCondition) {
|
||||
public RequestMappingInfo(RequestMappingInfo info, @Nullable RequestCondition<?> customRequestCondition) {
|
||||
this(info.name, info.patternsCondition, info.methodsCondition, info.paramsCondition, info.headersCondition,
|
||||
info.consumesCondition, info.producesCondition, customRequestCondition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user