Skip to content

Commit c9943aa

Browse files
committed
Timeout exceptions as RuntimeExceptions
Issue: SPR-14669 (cherry picked from commit e947363)
1 parent 9fa2a46 commit c9943aa

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/ConnectionLostException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -23,7 +23,7 @@
2323
* @since 4.2
2424
*/
2525
@SuppressWarnings("serial")
26-
public class ConnectionLostException extends Exception {
26+
public class ConnectionLostException extends RuntimeException {
2727

2828
public ConnectionLostException(String message) {
2929
super(message);

spring-web/src/main/java/org/springframework/web/context/request/async/AsyncRequestTimeoutException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.context.request.async;
1718

1819
/**
@@ -29,6 +30,6 @@
2930
* @since 4.2.8
3031
*/
3132
@SuppressWarnings("serial")
32-
public class AsyncRequestTimeoutException extends Exception {
33+
public class AsyncRequestTimeoutException extends RuntimeException {
3334

3435
}

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ else if (ex instanceof AsyncRequestTimeoutException) {
186186
(AsyncRequestTimeoutException) ex, headers, status, request);
187187
}
188188
else {
189-
logger.warn("Unknown exception type: " + ex.getClass().getName());
189+
if (logger.isWarnEnabled()) {
190+
logger.warn("Unknown exception type: " + ex.getClass().getName());
191+
}
190192
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
191193
return handleExceptionInternal(ex, null, headers, status, request);
192194
}

0 commit comments

Comments
 (0)