Skip to content

Commit aaf2e8f

Browse files
committed
Polishing
(cherry picked from commit edf7f3c)
1 parent 3635ff0 commit aaf2e8f

File tree

10 files changed

+29
-36
lines changed

10 files changed

+29
-36
lines changed

Diff for: spring-context/src/test/java/org/springframework/scheduling/concurrent/AbstractSchedulingTaskExecutorTests.java

+3-11
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,10 @@ void submitCompletableRunnableWithGetAfterShutdown() throws Exception {
209209
CompletableFuture<?> future1 = executor.submitCompletable(new TestTask(this.testName, -1));
210210
CompletableFuture<?> future2 = executor.submitCompletable(new TestTask(this.testName, -1));
211211
shutdownExecutor();
212-
213-
try {
212+
assertThatExceptionOfType(TimeoutException.class).isThrownBy(() -> {
214213
future1.get(1000, TimeUnit.MILLISECONDS);
215-
}
216-
catch (Exception ex) {
217-
// ignore
218-
}
219-
Awaitility.await()
220-
.atMost(5, TimeUnit.SECONDS)
221-
.pollInterval(10, TimeUnit.MILLISECONDS)
222-
.untilAsserted(() -> assertThatExceptionOfType(TimeoutException.class)
223-
.isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS)));
214+
future2.get(1000, TimeUnit.MILLISECONDS);
215+
});
224216
}
225217

226218
@Test

Diff for: spring-test/src/main/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListener.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ public void afterTestMethod(TestContext testContext) {
182182
@Override
183183
public void processAheadOfTime(RuntimeHints runtimeHints, Class<?> testClass, ClassLoader classLoader) {
184184
getSqlAnnotationsFor(testClass).forEach(sql ->
185-
registerClasspathResources(getScripts(sql, testClass, null, true), runtimeHints, classLoader));
185+
registerClasspathResources(getScripts(sql, testClass, null, true), runtimeHints, classLoader));
186186
getSqlMethods(testClass).forEach(testMethod ->
187-
getSqlAnnotationsFor(testMethod).forEach(sql ->
188-
registerClasspathResources(getScripts(sql, testClass, testMethod, false), runtimeHints, classLoader)));
187+
getSqlAnnotationsFor(testMethod).forEach(sql ->
188+
registerClasspathResources(getScripts(sql, testClass, testMethod, false), runtimeHints, classLoader)));
189189
}
190190

191191
/**

Diff for: spring-web/src/main/java/org/springframework/http/MediaType.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ public static String toString(Collection<MediaType> mediaTypes) {
853853
* <blockquote>audio/basic == text/html</blockquote>
854854
* <blockquote>audio/basic == audio/wave</blockquote>
855855
* @param mediaTypes the list of media types to be sorted
856-
* @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
856+
* @deprecated as of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
857857
*/
858858
@Deprecated(since = "6.0", forRemoval = true)
859859
public static void sortBySpecificity(List<MediaType> mediaTypes) {
@@ -882,7 +882,7 @@ public static void sortBySpecificity(List<MediaType> mediaTypes) {
882882
* </ol>
883883
* @param mediaTypes the list of media types to be sorted
884884
* @see #getQualityValue()
885-
* @deprecated As of 6.0, with no direct replacement
885+
* @deprecated as of 6.0, with no direct replacement
886886
*/
887887
@Deprecated(since = "6.0", forRemoval = true)
888888
public static void sortByQualityValue(List<MediaType> mediaTypes) {
@@ -895,9 +895,9 @@ public static void sortByQualityValue(List<MediaType> mediaTypes) {
895895
/**
896896
* Sorts the given list of {@code MediaType} objects by specificity as the
897897
* primary criteria and quality value the secondary.
898-
* @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
898+
* @deprecated as of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
899899
*/
900-
@Deprecated(since = "6.0")
900+
@Deprecated(since = "6.0", forRemoval = true)
901901
public static void sortBySpecificityAndQuality(List<MediaType> mediaTypes) {
902902
Assert.notNull(mediaTypes, "'mediaTypes' must not be null");
903903
if (mediaTypes.size() > 1) {
@@ -908,7 +908,7 @@ public static void sortBySpecificityAndQuality(List<MediaType> mediaTypes) {
908908

909909
/**
910910
* Comparator used by {@link #sortByQualityValue(List)}.
911-
* @deprecated As of 6.0, with no direct replacement
911+
* @deprecated as of 6.0, with no direct replacement
912912
*/
913913
@Deprecated(since = "6.0", forRemoval = true)
914914
public static final Comparator<MediaType> QUALITY_VALUE_COMPARATOR = (mediaType1, mediaType2) -> {
@@ -948,7 +948,7 @@ else if (!mediaType1.getSubtype().equals(mediaType2.getSubtype())) { // audio/b
948948

949949
/**
950950
* Comparator used by {@link #sortBySpecificity(List)}.
951-
* @deprecated As of 6.0, with no direct replacement
951+
* @deprecated as of 6.0, with no direct replacement
952952
*/
953953
@Deprecated(since = "6.0", forRemoval = true)
954954
@SuppressWarnings("removal")

Diff for: spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultAsyncServerResponse.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private DefaultAsyncServerResponse(CompletableFuture<ServerResponse> futureRespo
6767
this.timeout = timeout;
6868
}
6969

70+
7071
@Override
7172
public ServerResponse block() {
7273
try {
@@ -114,8 +115,8 @@ private <R> R delegate(Function<ServerResponse, R> function) {
114115
}
115116
}
116117

117-
@Nullable
118118
@Override
119+
@Nullable
119120
public ModelAndView writeTo(HttpServletRequest request, HttpServletResponse response, Context context)
120121
throws ServletException, IOException {
121122

@@ -169,6 +170,7 @@ private DeferredResult<ServerResponse> createDeferredResult(HttpServletRequest r
169170
return result;
170171
}
171172

173+
172174
@SuppressWarnings({"rawtypes", "unchecked"})
173175
public static AsyncServerResponse create(Object obj, @Nullable Duration timeout) {
174176
Assert.notNull(obj, "Argument to async must not be null");
@@ -192,5 +194,4 @@ else if (reactiveStreamsPresent) {
192194
throw new IllegalArgumentException("Asynchronous type not supported: " + obj.getClass());
193195
}
194196

195-
196197
}

Diff for: spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class DefaultServerResponseBuilderTests {
5454

5555
static final ServerResponse.Context EMPTY_CONTEXT = Collections::emptyList;
5656

57+
5758
@Test
5859
@SuppressWarnings("removal")
5960
void status() {
@@ -75,7 +76,6 @@ void from() {
7576
assertThat(result.cookies().getFirst("foo")).isEqualTo(cookie);
7677
}
7778

78-
7979
@Test
8080
void ok() {
8181
ServerResponse response = ServerResponse.ok().build();

Diff for: spring-websocket/spring-websocket.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ dependencies {
1616
exclude group: "org.apache.tomcat", module: "tomcat-servlet-api"
1717
exclude group: "org.apache.tomcat", module: "tomcat-websocket-api"
1818
}
19-
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") {
20-
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
21-
}
2219
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server")
2320
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server") {
2421
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
2522
}
23+
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") {
24+
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
25+
}
2626
optional("org.glassfish.tyrus:tyrus-container-servlet")
2727
testImplementation(testFixtures(project(":spring-core")))
2828
testImplementation(testFixtures(project(":spring-web")))

Diff for: spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/StandardToWebSocketExtensionAdapter.java

-2
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@
3434
*/
3535
public class StandardToWebSocketExtensionAdapter extends WebSocketExtension {
3636

37-
3837
public StandardToWebSocketExtensionAdapter(Extension extension) {
3938
super(extension.getName(), initParameters(extension));
4039
}
4140

42-
4341
private static Map<String, String> initParameters(Extension extension) {
4442
List<Extension.Parameter> parameters = extension.getParameters();
4543
Map<String, String> result = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ROOT);

Diff for: spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/WebSocketToStandardExtensionAdapter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,6 +55,7 @@ public String getValue() {
5555
}
5656
}
5757

58+
5859
@Override
5960
public String getName() {
6061
return this.name;

Diff for: spring-websocket/src/main/java/org/springframework/web/socket/messaging/WebSocketStompClient.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public CompletableFuture<StompSession> connectAsync(String url, StompSessionHand
234234

235235
/**
236236
* An overloaded version of
237-
* {@link #connect(String, StompSessionHandler, Object...)} that also
237+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also
238238
* accepts {@link WebSocketHttpHeaders} to use for the WebSocket handshake.
239239
* @param url the url to connect to
240240
* @param handshakeHeaders the headers for the WebSocket handshake
@@ -254,7 +254,7 @@ public org.springframework.util.concurrent.ListenableFuture<StompSession> connec
254254

255255
/**
256256
* An overloaded version of
257-
* {@link #connect(String, StompSessionHandler, Object...)} that also
257+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also
258258
* accepts {@link WebSocketHttpHeaders} to use for the WebSocket handshake.
259259
* @param url the url to connect to
260260
* @param handshakeHeaders the headers for the WebSocket handshake
@@ -271,7 +271,7 @@ public CompletableFuture<StompSession> connectAsync(String url, @Nullable WebSoc
271271

272272
/**
273273
* An overloaded version of
274-
* {@link #connect(String, StompSessionHandler, Object...)} that also accepts
274+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also accepts
275275
* {@link WebSocketHttpHeaders} to use for the WebSocket handshake and
276276
* {@link StompHeaders} for the STOMP CONNECT frame.
277277
* @param url the url to connect to
@@ -293,7 +293,7 @@ public org.springframework.util.concurrent.ListenableFuture<StompSession> connec
293293

294294
/**
295295
* An overloaded version of
296-
* {@link #connect(String, StompSessionHandler, Object...)} that also accepts
296+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also accepts
297297
* {@link WebSocketHttpHeaders} to use for the WebSocket handshake and
298298
* {@link StompHeaders} for the STOMP CONNECT frame.
299299
* @param url the url to connect to
@@ -314,7 +314,7 @@ public CompletableFuture<StompSession> connectAsync(String url, @Nullable WebSoc
314314

315315
/**
316316
* An overloaded version of
317-
* {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
317+
* {@link #connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
318318
* that accepts a fully prepared {@link java.net.URI}.
319319
* @param url the url to connect to
320320
* @param handshakeHeaders the headers for the WebSocket handshake
@@ -334,7 +334,7 @@ public org.springframework.util.concurrent.ListenableFuture<StompSession> connec
334334

335335
/**
336336
* An overloaded version of
337-
* {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
337+
* {@link #connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
338338
* that accepts a fully prepared {@link java.net.URI}.
339339
* @param url the url to connect to
340340
* @param handshakeHeaders the headers for the WebSocket handshake

Diff for: spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/DefaultTransportRequest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -278,6 +278,7 @@ private void handleFailure(@Nullable Throwable ex, boolean isTimeoutFailure) {
278278
}
279279
}
280280

281+
281282
/**
282283
* Updates the given (global) future based success or failure to connect for
283284
* the entire SockJS request regardless of which transport actually managed

0 commit comments

Comments
 (0)