diff --git a/spring-context/src/main/java/org/springframework/validation/ObjectError.java b/spring-context/src/main/java/org/springframework/validation/ObjectError.java index 0e19cc7b934..53aee336d35 100644 --- a/spring-context/src/main/java/org/springframework/validation/ObjectError.java +++ b/spring-context/src/main/java/org/springframework/validation/ObjectError.java @@ -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); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java index 85855bafcc1..8c38763ca05 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java @@ -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. diff --git a/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTestTransactionManager.java b/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTestTransactionManager.java index e43f341b2c8..852dbfbffc4 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTestTransactionManager.java +++ b/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTestTransactionManager.java @@ -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. diff --git a/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTransactionSupportTests.java b/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTransactionSupportTests.java index 20db5ea65d6..e99a38281cb 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTransactionSupportTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/reactive/ReactiveTransactionSupportTests.java @@ -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. diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessor.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessor.java index 9f8de78c336..8848067c7e7 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessor.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessor.java @@ -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); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java index b04a5383def..a97fbd90256 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java @@ -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 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> 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> attributesConsumer) { - Assert.notNull(attributesConsumer, "AttributesConsumer must not be null"); + Assert.notNull(attributesConsumer, "Attributes consumer must not be null"); attributesConsumer.accept(this.attributes); return this; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java index be86aa1a109..ed2e5cf3fdf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java @@ -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 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> 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> 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> paramsConsumer) { - Assert.notNull(paramsConsumer, "paramsConsumer must not be null"); + Assert.notNull(paramsConsumer, "Parameters consumer must not be null"); paramsConsumer.accept(this.params); return this; } diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 26a08929292..a298ea57386 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -25,7 +25,7 @@ - + @@ -33,7 +33,7 @@ - +