File tree 3 files changed +11
-3
lines changed
java-client/src/main/java/org/opensearch/client/transport
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
52
52
### Removed
53
53
54
54
### Fixed
55
-
55
+ - Fixed ClassCastException in extractAndWrapCause when handling ExecutionException
56
56
### Security
57
57
58
58
## [ 2.22.0] - 03/05/2025
Original file line number Diff line number Diff line change @@ -694,7 +694,11 @@ private static Exception extractAndWrapCause(Exception exception) {
694
694
if (t instanceof Error ) {
695
695
throw (Error ) t ;
696
696
}
697
- exception = (Exception ) t ;
697
+ if (t instanceof Exception ) {
698
+ exception = (Exception ) t ;
699
+ } else {
700
+ exception = new RuntimeException ("Unexpected throwable caught in execution" , t );
701
+ }
698
702
}
699
703
if (exception instanceof SocketTimeoutException ) {
700
704
SocketTimeoutException e = new SocketTimeoutException (exception .getMessage ());
Original file line number Diff line number Diff line change @@ -1107,7 +1107,11 @@ private static Exception extractAndWrapCause(Exception exception) {
1107
1107
if (t instanceof Error ) {
1108
1108
throw (Error ) t ;
1109
1109
}
1110
- exception = (Exception ) t ;
1110
+ if (t instanceof Exception ) {
1111
+ exception = (Exception ) t ;
1112
+ } else {
1113
+ exception = new RuntimeException ("Unexpected throwable caught in execution" , t );
1114
+ }
1111
1115
}
1112
1116
if (exception instanceof ConnectTimeoutException ) {
1113
1117
ConnectTimeoutException e = new ConnectTimeoutException (exception .getMessage ());
You can’t perform that action at this time.
0 commit comments