Skip to content

[Backport 2.x] Fix ClassCastException in extractAndWrapCause when handling Execution… #1485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Removed

### Fixed

- Fixed ClassCastException in extractAndWrapCause when handling ExecutionException ([#1483](https://github.com/opensearch-project/opensearch-java/pull/1483))
### Security

## [2.22.0] - 03/05/2025
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.URI;
Expand Down Expand Up @@ -694,7 +695,11 @@ private static Exception extractAndWrapCause(Exception exception) {
if (t instanceof Error) {
throw (Error) t;
}
exception = (Exception) t;
if (t instanceof Exception) {
exception = (Exception) t;
} else {
exception = new UndeclaredThrowableException(t);
}
}
if (exception instanceof SocketTimeoutException) {
SocketTimeoutException e = new SocketTimeoutException(exception.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.URI;
Expand Down Expand Up @@ -1107,7 +1108,11 @@ private static Exception extractAndWrapCause(Exception exception) {
if (t instanceof Error) {
throw (Error) t;
}
exception = (Exception) t;
if (t instanceof Exception) {
exception = (Exception) t;
} else {
exception = new UndeclaredThrowableException(t);
}
}
if (exception instanceof ConnectTimeoutException) {
ConnectTimeoutException e = new ConnectTimeoutException(exception.getMessage());
Expand Down
Loading