Polishing
This commit is contained in:
parent
3431b2330a
commit
9cf7b0e230
|
@ -46,7 +46,7 @@ public class ObjectError extends DefaultMessageSourceResolvable {
|
|||
* @param objectName the name of the affected object
|
||||
* @param defaultMessage the default message to be used to resolve this message
|
||||
*/
|
||||
public ObjectError(String objectName, String defaultMessage) {
|
||||
public ObjectError(String objectName, @Nullable String defaultMessage) {
|
||||
this(objectName, null, null, defaultMessage);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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-2019 the original author or authors.
|
||||
* Copyright 2002-2023 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-2023 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.
|
||||
|
|
|
@ -335,8 +335,8 @@ public class ModelAttributeMethodProcessor implements HandlerMethodArgumentResol
|
|||
return BeanUtils.instantiateClass(ctor, args);
|
||||
}
|
||||
catch (BeanInstantiationException ex) {
|
||||
Throwable cause = ex.getCause();
|
||||
if (KotlinDetector.isKotlinType(ctor.getDeclaringClass()) && cause instanceof NullPointerException) {
|
||||
if (KotlinDetector.isKotlinType(ctor.getDeclaringClass()) &&
|
||||
ex.getCause() instanceof NullPointerException cause) {
|
||||
BindingResult result = binder.getBindingResult();
|
||||
ObjectError error = new ObjectError(ctor.getName(), cause.getMessage());
|
||||
result.addError(error);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
@ -122,7 +122,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder header(String headerName, String... headerValues) {
|
||||
Assert.notNull(headerName, "Header Name must not be null");
|
||||
Assert.notNull(headerName, "Header name must not be null");
|
||||
for (String headerValue : headerValues) {
|
||||
this.headers.add(headerName, headerValue);
|
||||
}
|
||||
|
@ -131,14 +131,14 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder headers(Consumer<HttpHeaders> headersConsumer) {
|
||||
Assert.notNull(headersConsumer, "Header Consumer must not be null");
|
||||
Assert.notNull(headersConsumer, "Headers consumer must not be null");
|
||||
headersConsumer.accept(this.headers);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder cookie(String name, String... values) {
|
||||
Assert.notNull(name, "Cookie Name must not be null");
|
||||
Assert.notNull(name, "Cookie name must not be null");
|
||||
for (String value : values) {
|
||||
this.cookies.add(name, new HttpCookie(name, value));
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder cookies(Consumer<MultiValueMap<String, HttpCookie>> cookiesConsumer) {
|
||||
Assert.notNull(cookiesConsumer, "Cookie Consumer must not be null");
|
||||
Assert.notNull(cookiesConsumer, "Cookies consumer must not be null");
|
||||
cookiesConsumer.accept(this.cookies);
|
||||
return this;
|
||||
}
|
||||
|
@ -178,14 +178,14 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder attribute(String name, Object value) {
|
||||
Assert.notNull(name, "name must not be null");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
this.attributes.put(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder attributes(Consumer<Map<String, Object>> attributesConsumer) {
|
||||
Assert.notNull(attributesConsumer, "AttributesConsumer must not be null");
|
||||
Assert.notNull(attributesConsumer, "Attributes consumer must not be null");
|
||||
attributesConsumer.accept(this.attributes);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder header(String headerName, String... headerValues) {
|
||||
Assert.notNull(headerName, "Header Name must not be null");
|
||||
Assert.notNull(headerName, "Header name must not be null");
|
||||
for (String headerValue : headerValues) {
|
||||
this.headers.add(headerName, headerValue);
|
||||
}
|
||||
|
@ -124,14 +124,14 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder headers(Consumer<HttpHeaders> headersConsumer) {
|
||||
Assert.notNull(headersConsumer, "Header Consumer must not be null");
|
||||
Assert.notNull(headersConsumer, "Headers consumer must not be null");
|
||||
headersConsumer.accept(this.headers);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder cookie(String name, String... values) {
|
||||
Assert.notNull(name, "Cookie Name must not be null");
|
||||
Assert.notNull(name, "Cookie name must not be null");
|
||||
for (String value : values) {
|
||||
this.cookies.add(name, new Cookie(name, value));
|
||||
}
|
||||
|
@ -140,41 +140,41 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder cookies(Consumer<MultiValueMap<String, Cookie>> cookiesConsumer) {
|
||||
Assert.notNull(cookiesConsumer, "Cookie Consumer must not be null");
|
||||
Assert.notNull(cookiesConsumer, "Cookies consumer must not be null");
|
||||
cookiesConsumer.accept(this.cookies);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder body(byte[] body) {
|
||||
Assert.notNull(body, "body must not be null");
|
||||
Assert.notNull(body, "Body must not be null");
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder body(String body) {
|
||||
Assert.notNull(body, "body must not be null");
|
||||
Assert.notNull(body, "Body must not be null");
|
||||
return body(body.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder attribute(String name, Object value) {
|
||||
Assert.notNull(name, "name must not be null");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
this.attributes.put(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder attributes(Consumer<Map<String, Object>> attributesConsumer) {
|
||||
Assert.notNull(attributesConsumer, "AttributesConsumer must not be null");
|
||||
Assert.notNull(attributesConsumer, "Attributes consumer must not be null");
|
||||
attributesConsumer.accept(this.attributes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerRequest.Builder param(String name, String... values) {
|
||||
Assert.notNull(name, "name must not be null");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
for (String value : values) {
|
||||
this.params.add(name, value);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ServerRequest.Builder params(Consumer<MultiValueMap<String, String>> paramsConsumer) {
|
||||
Assert.notNull(paramsConsumer, "paramsConsumer must not be null");
|
||||
Assert.notNull(paramsConsumer, "Parameters consumer must not be null");
|
||||
paramsConsumer.accept(this.params);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<property name="id" value="packageLevelNonNullApiAnnotation"/>
|
||||
<property name="format" value="@NonNullApi"/>
|
||||
<property name="minimum" value="1"/>
|
||||
<property name="maximum" value="1"/>
|
||||
<property name="maximum" value="1"/>
|
||||
<property name="message" value="package-info.java is missing required null-safety annotation @NonNullApi."/>
|
||||
<property name="ignoreComments" value="true"/>
|
||||
</module>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<property name="id" value="packageLevelNonNullFieldsAnnotation"/>
|
||||
<property name="format" value="@NonNullFields"/>
|
||||
<property name="minimum" value="1"/>
|
||||
<property name="maximum" value="1"/>
|
||||
<property name="maximum" value="1"/>
|
||||
<property name="message" value="package-info.java is missing required null-safety annotation @NonNullFields."/>
|
||||
<property name="ignoreComments" value="true"/>
|
||||
</module>
|
||||
|
|
Loading…
Reference in New Issue