Skip to content

Commit ee804ee

Browse files
committed
Avoid throwing of plain RuntimeException
1 parent 4e5979c commit ee804ee

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -17,6 +17,7 @@
1717
package org.springframework.context.aot;
1818

1919
import java.io.IOException;
20+
import java.io.UncheckedIOException;
2021
import java.nio.file.Path;
2122

2223
import org.springframework.aot.generate.FileSystemGeneratedFiles;
@@ -102,7 +103,7 @@ private void deleteExistingOutput(Path... paths) {
102103
FileSystemUtils.deleteRecursively(path);
103104
}
104105
catch (IOException ex) {
105-
throw new RuntimeException("Failed to delete existing output in '" + path + "'");
106+
throw new UncheckedIOException("Failed to delete existing output in '" + path + "'", ex);
106107
}
107108
}
108109
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -205,9 +205,9 @@ static final class SubscribingRunnable implements SchedulingAwareRunnable {
205205
final Supplier<ScheduledTaskObservationContext> contextSupplier;
206206

207207
SubscribingRunnable(Publisher<?> publisher, boolean shouldBlock,
208-
@Nullable String qualifier, List<Runnable> subscriptionTrackerRegistry,
209-
String displayName, Supplier<ObservationRegistry> observationRegistrySupplier,
210-
Supplier<ScheduledTaskObservationContext> contextSupplier) {
208+
@Nullable String qualifier, List<Runnable> subscriptionTrackerRegistry,
209+
String displayName, Supplier<ObservationRegistry> observationRegistrySupplier,
210+
Supplier<ScheduledTaskObservationContext> contextSupplier) {
211211

212212
this.publisher = publisher;
213213
this.shouldBlock = shouldBlock;
@@ -236,7 +236,7 @@ public void run() {
236236
latch.await();
237237
}
238238
catch (InterruptedException ex) {
239-
throw new RuntimeException(ex);
239+
Thread.currentThread().interrupt();
240240
}
241241
}
242242
else {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -191,7 +191,7 @@ public final MockMvc build() {
191191
filterDecorator.initIfRequired(servletContext);
192192
}
193193
catch (ServletException ex) {
194-
throw new RuntimeException("Failed to initialize Filter " + filter, ex);
194+
throw new IllegalStateException("Failed to initialize Filter " + filter, ex);
195195
}
196196
}
197197
}

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -27,7 +27,6 @@
2727
*/
2828
public interface SmartView extends View {
2929

30-
3130
/**
3231
* Whether the view performs a redirect.
3332
*/

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -404,7 +404,7 @@ public void handle(ModelAndView modelAndView) throws IOException {
404404
throw ex;
405405
}
406406
catch (Exception ex) {
407-
throw new RuntimeException("Failed to render " + modelAndView, ex);
407+
throw new IllegalStateException("Failed to render " + modelAndView, ex);
408408
}
409409
finally {
410410
RequestContextHolder.resetRequestAttributes();

0 commit comments

Comments
 (0)