Browse Source

Merge branch '7.0.x'

pull/36514/head
Juergen Hoeller 1 week ago
parent
commit
a0dba60fa6
  1. 2
      framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvccontroller/mvcannexceptionhandlerexc/ExceptionController.java
  2. 2
      framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvccontroller/mvcannexceptionhandlerexc/ExceptionController.kt
  3. 2
      spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml
  4. 6
      spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java
  5. 2
      spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java
  6. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java
  7. 2
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/SockJsSessionTests.java

2
framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvccontroller/mvcannexceptionhandlerexc/ExceptionController.java

@ -29,7 +29,7 @@ public class ExceptionController {
// tag::narrow[] // tag::narrow[]
@ExceptionHandler({FileSystemException.class, RemoteException.class}) @ExceptionHandler({FileSystemException.class, RemoteException.class})
public ResponseEntity<String> handleIoException(IOException ex) { public ResponseEntity<String> handleIOException(IOException ex) {
return ResponseEntity.internalServerError().body(ex.getMessage()); return ResponseEntity.internalServerError().body(ex.getMessage());
} }
// end::narrow[] // end::narrow[]

2
framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvccontroller/mvcannexceptionhandlerexc/ExceptionController.kt

@ -27,7 +27,7 @@ class ExceptionController {
// tag::narrow[] // tag::narrow[]
@ExceptionHandler(FileSystemException::class, RemoteException::class) @ExceptionHandler(FileSystemException::class, RemoteException::class)
fun handleIoException(ex: IOException): ResponseEntity<String> { fun handleIOException(ex: IOException): ResponseEntity<String> {
return ResponseEntity.internalServerError().body(ex.message) return ResponseEntity.internalServerError().body(ex.message)
} }
// end::narrow[] // end::narrow[]

2
spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml

@ -209,7 +209,7 @@
<value>1205,3572</value> <value>1205,3572</value>
</property> </property>
<property name="deadlockLoserCodes"> <property name="deadlockLoserCodes">
<value>1213</value> <value>149,1213</value>
</property> </property>
</bean> </bean>

6
spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java

@ -735,14 +735,20 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
long receiveTimeout = getReceiveTimeout(); long receiveTimeout = getReceiveTimeout();
long waitStartTime = System.currentTimeMillis(); long waitStartTime = System.currentTimeMillis();
int waitCount = 0; int waitCount = 0;
boolean interrupted = false;
while (this.activeInvokerCount > 0) { while (this.activeInvokerCount > 0) {
if (waitCount > 0 && !isAcceptMessagesWhileStopping() && if (waitCount > 0 && !isAcceptMessagesWhileStopping() &&
System.currentTimeMillis() - waitStartTime >= receiveTimeout) { System.currentTimeMillis() - waitStartTime >= receiveTimeout) {
// Unexpectedly some invokers are still active after the receive timeout period // Unexpectedly some invokers are still active after the receive timeout period
// -> interrupt remaining receive attempts since we'd reject the messages anyway // -> interrupt remaining receive attempts since we'd reject the messages anyway
if (interrupted) {
// Already interrupted -> not worth waiting any longer...
break;
}
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) { for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
scheduledInvoker.interruptIfNecessary(); scheduledInvoker.interruptIfNecessary();
} }
interrupted = true;
} }
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount + logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +

2
spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java

@ -149,7 +149,7 @@ class RestTemplateObservationTests {
} }
@Test @Test
void executeWithIoExceptionAddsUnknownOutcome() throws Exception { void executeWithIOExceptionAddsUnknownOutcome() throws Exception {
String url = "https://example.org/resource"; String url = "https://example.org/resource";
mockSentRequest(GET, url); mockSentRequest(GET, url);
given(request.execute()).willThrow(new IOException("Socket failure")); given(request.execute()).willThrow(new IOException("Socket failure"));

4
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java

@ -172,7 +172,7 @@ class ExceptionHandlerExceptionResolverTests {
@Test @Test
void resolveNoExceptionHandlerForException() throws NoSuchMethodException { void resolveNoExceptionHandlerForException() throws NoSuchMethodException {
Exception npe = new NullPointerException(); Exception npe = new NullPointerException();
HandlerMethod handlerMethod = new HandlerMethod(new IoExceptionController(), "handle"); HandlerMethod handlerMethod = new HandlerMethod(new IOExceptionController(), "handle");
this.resolver.afterPropertiesSet(); this.resolver.afterPropertiesSet();
ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, npe); ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, npe);
@ -540,7 +540,7 @@ class ExceptionHandlerExceptionResolverTests {
@Controller @Controller
static class IoExceptionController { static class IOExceptionController {
public void handle() {} public void handle() {}

2
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/SockJsSessionTests.java

@ -240,7 +240,7 @@ class SockJsSessionTests extends AbstractSockJsSessionTests<TestSockJsSession> {
} }
@Test @Test
void writeFrameIoException() throws Exception { void writeFrameIOException() throws Exception {
this.session.setExceptionOnWrite(new IOException()); this.session.setExceptionOnWrite(new IOException());
this.session.delegateConnectionEstablished(); this.session.delegateConnectionEstablished();

Loading…
Cancel
Save