Browse Source

Avoid throwing of plain RuntimeException

pull/34732/head
Juergen Hoeller 9 months ago
parent
commit
ee804ee8fb
  1. 5
      spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java
  2. 10
      spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationReactiveSupport.java
  3. 4
      spring-test/src/main/java/org/springframework/test/web/servlet/setup/AbstractMockMvcBuilder.java
  4. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/SmartView.java
  5. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java

5
spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.springframework.context.aot;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Path;
import org.springframework.aot.generate.FileSystemGeneratedFiles;
@ -102,7 +103,7 @@ public abstract class AbstractAotProcessor<T> { @@ -102,7 +103,7 @@ public abstract class AbstractAotProcessor<T> {
FileSystemUtils.deleteRecursively(path);
}
catch (IOException ex) {
throw new RuntimeException("Failed to delete existing output in '" + path + "'");
throw new UncheckedIOException("Failed to delete existing output in '" + path + "'", ex);
}
}
}

10
spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationReactiveSupport.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -205,9 +205,9 @@ abstract class ScheduledAnnotationReactiveSupport { @@ -205,9 +205,9 @@ abstract class ScheduledAnnotationReactiveSupport {
final Supplier<ScheduledTaskObservationContext> contextSupplier;
SubscribingRunnable(Publisher<?> publisher, boolean shouldBlock,
@Nullable String qualifier, List<Runnable> subscriptionTrackerRegistry,
String displayName, Supplier<ObservationRegistry> observationRegistrySupplier,
Supplier<ScheduledTaskObservationContext> contextSupplier) {
@Nullable String qualifier, List<Runnable> subscriptionTrackerRegistry,
String displayName, Supplier<ObservationRegistry> observationRegistrySupplier,
Supplier<ScheduledTaskObservationContext> contextSupplier) {
this.publisher = publisher;
this.shouldBlock = shouldBlock;
@ -236,7 +236,7 @@ abstract class ScheduledAnnotationReactiveSupport { @@ -236,7 +236,7 @@ abstract class ScheduledAnnotationReactiveSupport {
latch.await();
}
catch (InterruptedException ex) {
throw new RuntimeException(ex);
Thread.currentThread().interrupt();
}
}
else {

4
spring-test/src/main/java/org/springframework/test/web/servlet/setup/AbstractMockMvcBuilder.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2025 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.
@ -191,7 +191,7 @@ public abstract class AbstractMockMvcBuilder<B extends AbstractMockMvcBuilder<B> @@ -191,7 +191,7 @@ public abstract class AbstractMockMvcBuilder<B extends AbstractMockMvcBuilder<B>
filterDecorator.initIfRequired(servletContext);
}
catch (ServletException ex) {
throw new RuntimeException("Failed to initialize Filter " + filter, ex);
throw new IllegalStateException("Failed to initialize Filter " + filter, ex);
}
}
}

3
spring-webmvc/src/main/java/org/springframework/web/servlet/SmartView.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -27,7 +27,6 @@ import java.util.Locale; @@ -27,7 +27,6 @@ import java.util.Locale;
*/
public interface SmartView extends View {
/**
* Whether the view performs a redirect.
*/

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -404,7 +404,7 @@ public class ResponseBodyEmitterReturnValueHandler implements HandlerMethodRetur @@ -404,7 +404,7 @@ public class ResponseBodyEmitterReturnValueHandler implements HandlerMethodRetur
throw ex;
}
catch (Exception ex) {
throw new RuntimeException("Failed to render " + modelAndView, ex);
throw new IllegalStateException("Failed to render " + modelAndView, ex);
}
finally {
RequestContextHolder.resetRequestAttributes();

Loading…
Cancel
Save