From b67039d19ab81ebfae5af7ffe111be9d7cc735c6 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 20 Mar 2019 20:16:18 +0100 Subject: [PATCH] Fix checkstyle issue --- .../reactive/function/server/package-info.java | 16 ---------------- .../function/DefaultEntityResponseBuilder.java | 3 ++- .../servlet/function/DefaultServerRequest.java | 11 +++++++---- .../function/DefaultServerRequestBuilder.java | 3 ++- .../function/DefaultServerResponseBuilder.java | 5 +++-- .../web/servlet/function/EntityResponse.java | 1 + .../web/servlet/function/RouterFunctions.java | 7 ++++--- .../web/servlet/function/ServerRequest.java | 2 +- .../web/servlet/function/ServerResponse.java | 3 ++- .../servlet/function/support/package-info.java | 16 ---------------- 10 files changed, 22 insertions(+), 45 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/package-info.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/package-info.java index a67971d4ce..0fc2f21a0d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/package-info.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/package-info.java @@ -1,19 +1,3 @@ -/* - * Copyright 2002-2019 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /** * Provides the types that make up Spring's functional web framework for Reactive environments. */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilder.java index d6acce370f..8bb868763d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilder.java @@ -62,8 +62,9 @@ import org.springframework.web.servlet.ModelAndView; * * @author Arjen Poutsma * @since 5.2 + * @param the entity type */ -class DefaultEntityResponseBuilder implements EntityResponse.Builder { +final class DefaultEntityResponseBuilder implements EntityResponse.Builder { private final T entity; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java index 0803863d1c..aef87defb3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java @@ -220,7 +220,8 @@ class DefaultServerRequest implements ServerRequest { .getAttribute(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE); if (pathVariables != null) { return pathVariables; - } else { + } + else { return Collections.emptyMap(); } } @@ -235,7 +236,9 @@ class DefaultServerRequest implements ServerRequest { return Optional.ofNullable(this.serverHttpRequest.getPrincipal()); } - + /** + * Default implementation of {@link Headers}. + */ static class DefaultRequestHeaders implements Headers { private final HttpHeaders delegate; @@ -298,7 +301,7 @@ class DefaultServerRequest implements ServerRequest { } } - private static class ServletParametersMap extends AbstractMap> { + private static final class ServletParametersMap extends AbstractMap> { private final HttpServletRequest servletRequest; @@ -353,7 +356,7 @@ class DefaultServerRequest implements ServerRequest { } - private static class ServletAttributesMap extends AbstractMap { + private static final class ServletAttributesMap extends AbstractMap { private final HttpServletRequest servletRequest; 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 31eba479cf..0caee0c792 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 @@ -283,7 +283,8 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder { .get(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE); if (pathVariables != null) { return pathVariables; - } else { + } + else { return Collections.emptyMap(); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerResponseBuilder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerResponseBuilder.java index 1c40459443..dae73bdefc 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerResponseBuilder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerResponseBuilder.java @@ -286,8 +286,9 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { else { return writeToInternal(request, response, context); } - } catch (Throwable t) { - return handleError(t, request, response, context); + } + catch (Throwable throwable) { + return handleError(throwable, request, response, context); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/EntityResponse.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/EntityResponse.java index 7e859a1dd1..a68e63435c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/EntityResponse.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/EntityResponse.java @@ -72,6 +72,7 @@ public interface EntityResponse extends ServerResponse { /** * Defines a builder for {@code EntityResponse}. + * @param the entity type */ interface Builder { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java index f6c459398c..a0303baeff 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java @@ -830,10 +830,11 @@ public abstract class RouterFunctions { "Nested predicate \"%s\" matches against \"%s\"", this.predicate, serverRequest)); } - Optional> result = this.routerFunction.route(nestedRequest); + Optional> result = + this.routerFunction.route(nestedRequest); if (result.isPresent() && nestedRequest != serverRequest) { - serverRequest.attributes().clear(); - serverRequest.attributes().putAll(nestedRequest.attributes()); + serverRequest.attributes().clear(); + serverRequest.attributes().putAll(nestedRequest.attributes()); } return result; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerRequest.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerRequest.java index 247b1d8a51..421c7f9180 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerRequest.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerRequest.java @@ -223,7 +223,7 @@ public interface ServerRequest { // Static methods /** - * Create a new {@code ServerRequest} based on the given {@code {@link HttpServletRequest} and + * Create a new {@code ServerRequest} based on the given {@code HttpServletRequest} and * message converters. * @param servletRequest the request * @param messageReaders the message readers diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java index f931698110..23ff9276e6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java @@ -71,7 +71,8 @@ public interface ServerResponse { MultiValueMap cookies(); /** - * Write this response to the servlet response (and return {@code null}, or return a + * Write this response to the servlet response (and return {@code null}, or return a model and + * view. * @param request the current request * @param response the response to write to * @param context the context to use when writing diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/package-info.java index b5c58ed0ef..a41208ab31 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/package-info.java @@ -1,19 +1,3 @@ -/* - * Copyright 2002-2019 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /** * Classes supporting the {@code org.springframework.web.servlet.function} package. * Contains a {@code HandlerAdapter} that supports {@code HandlerFunction}s,