Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
This commit is contained in:
@@ -69,9 +69,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());
|
||||
@@ -86,9 +86,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);
|
||||
}
|
||||
@@ -96,7 +96,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