Skip to content

Commit 6c054f8

Browse files
committed
Defensively handle UncheckedIOException cause (for NullAway compliance)
1 parent f58c7d8 commit 6c054f8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

spring-web/src/main/java/org/springframework/http/client/ReactorNettyClientRequest.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,16 @@ static IOException convertException(RuntimeException ex) {
131131
// Exceptions.ReactiveException is package private
132132
Throwable cause = ex.getCause();
133133

134-
if (cause instanceof UncheckedIOException uioEx) {
135-
return uioEx.getCause();
136-
}
137-
else if (cause instanceof IOException ioEx) {
134+
if (cause instanceof IOException ioEx) {
138135
return ioEx;
139136
}
140-
else {
141-
return new IOException(ex.getMessage(), cause);
137+
if (cause instanceof UncheckedIOException uioEx) {
138+
IOException ioEx = uioEx.getCause();
139+
if (ioEx != null) {
140+
return ioEx;
141+
}
142142
}
143+
return new IOException(ex.getMessage(), cause);
143144
}
144145

145146

0 commit comments

Comments
 (0)