diff --git a/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java b/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java index bb33c66999..c62200b3e7 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java @@ -108,16 +108,13 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect /** * Subclasses must implement the actual validation of the request * matching to declared expectations. - * @deprecated as of 5.0.3 sub-classes should implement - * {@link #matchRequest(ClientHttpRequest)} instead and return only the matched - * expectation, leaving the call to create the response as a separate step - * (to be invoked by this class). + * @deprecated as of 5.0.3, subclasses should implement {@link #matchRequest(ClientHttpRequest)} + * instead and return only the matched expectation, leaving the call to create the response + * as a separate step (to be invoked by this class). */ @Deprecated @Nullable - protected ClientHttpResponse validateRequestInternal(ClientHttpRequest request) - throws IOException { - + protected ClientHttpResponse validateRequestInternal(ClientHttpRequest request) throws IOException { return null; } @@ -132,9 +129,8 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect * @since 5.0.3 */ protected RequestExpectation matchRequest(ClientHttpRequest request) throws IOException { - throw new java.lang.UnsupportedOperationException( - "It looks like neither the deprecated \"validateRequestInternal\"" + - "nor its replacement (this method) are implemented."); + throw new UnsupportedOperationException("It looks like neither the deprecated \"validateRequestInternal\"" + + "nor its replacement (this method) are implemented."); } @Override @@ -197,15 +193,13 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect private final Set expectations = new LinkedHashSet<>(); - - public Set getExpectations() { - return this.expectations; - } - public void addAllExpectations(Collection expectations) { this.expectations.addAll(expectations); } + public Set getExpectations() { + return this.expectations; + } /** * Return a matching expectation, or {@code null} if none match. diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java index bc4beb00ec..25f16ffd4b 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -44,7 +44,6 @@ import org.springframework.core.io.buffer.DefaultDataBufferFactory; import org.springframework.http.HttpMethod; import org.springframework.lang.Nullable; import org.springframework.util.Assert; -import org.springframework.web.util.NestedServletException; /** * Adapt {@link HttpHandler} to an {@link HttpServlet} using Servlet Async @@ -157,11 +156,9 @@ public class ServletHttpHandlerAdapter implements Servlet { @Override public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { - if (DispatcherType.ASYNC.equals(request.getDispatcherType())) { Throwable ex = (Throwable) request.getAttribute(WRITE_ERROR_ATTRIBUTE_NAME); - Assert.notNull(ex, "Unexpected async dispatch"); - throw new NestedServletException("Write publisher error", ex); + throw new ServletException("Write publisher error", ex); } // Start async before Read/WriteListener registration @@ -230,7 +227,6 @@ public class ServletHttpHandlerAdapter implements Servlet { private final AtomicBoolean isCompleted; - public HandlerResultAsyncListener(AtomicBoolean isCompleted) { this.isCompleted = isCompleted; } @@ -267,7 +263,6 @@ public class ServletHttpHandlerAdapter implements Servlet { private final AtomicBoolean isCompleted; - public HandlerResultSubscriber(AsyncContext asyncContext, AtomicBoolean isCompleted) { this.asyncContext = asyncContext; this.isCompleted = isCompleted; diff --git a/spring-web/src/main/java/org/springframework/web/cors/reactive/CorsUtils.java b/spring-web/src/main/java/org/springframework/web/cors/reactive/CorsUtils.java index 5ddbf6d96c..099ecb198f 100644 --- a/spring-web/src/main/java/org/springframework/web/cors/reactive/CorsUtils.java +++ b/spring-web/src/main/java/org/springframework/web/cors/reactive/CorsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 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. @@ -19,12 +19,11 @@ package org.springframework.web.cors.reactive; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; -; - /** * Utility class for CORS reactive request handling based on the * CORS W3C recommendation. @@ -71,7 +70,7 @@ public abstract class CorsUtils { return (actualHost.equals(originUrl.getHost()) && actualPort == getPort(originUrl.getScheme(), originUrl.getPort())); } - private static int getPort(String scheme, int port) { + private static int getPort(@Nullable String scheme, int port) { if (port == -1) { if ("http".equals(scheme) || "ws".equals(scheme)) { port = 80; diff --git a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java index 1904c225bf..b59dbdbe9a 100644 --- a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -754,7 +754,7 @@ public abstract class WebUtils { return false; } - private static int getPort(String scheme, int port) { + private static int getPort(@Nullable String scheme, int port) { if (port == -1) { if ("http".equals(scheme) || "ws".equals(scheme)) { port = 80;