Browse Source

Polishing

pull/30108/head
Sam Brannen 2 years ago
parent
commit
9cf7b0e230
  1. 2
      spring-context/src/main/java/org/springframework/validation/ObjectError.java
  2. 2
      spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java
  3. 2
      spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTestTransactionManager.java
  4. 2
      spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTransactionSupportTests.java
  5. 4
      spring-web/src/main/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessor.java
  6. 14
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java
  7. 20
      spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java
  8. 4
      src/checkstyle/checkstyle.xml

2
spring-context/src/main/java/org/springframework/validation/ObjectError.java

@ -46,7 +46,7 @@ public class ObjectError extends DefaultMessageSourceResolvable { @@ -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);
}

2
spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java

@ -1,5 +1,5 @@ @@ -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.

2
spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTestTransactionManager.java

@ -1,5 +1,5 @@ @@ -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.

2
spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTransactionSupportTests.java

@ -1,5 +1,5 @@ @@ -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.

4
spring-web/src/main/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessor.java

@ -335,8 +335,8 @@ public class ModelAttributeMethodProcessor implements HandlerMethodArgumentResol @@ -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);

14
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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;
}

20
spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java

@ -115,7 +115,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder { @@ -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 { @@ -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 { @@ -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 { @@ -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;
}

4
src/checkstyle/checkstyle.xml

@ -25,7 +25,7 @@ @@ -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 @@ @@ -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…
Cancel
Save