Skip to content

Commit d45d2be

Browse files
authored
IGNITE-26757 Revert deletion of extra exception handling during ErrorMessage marshaling (#12471)
1 parent 31dc8f5 commit d45d2be

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

modules/core/src/main/java/org/apache/ignite/internal/managers/communication/ErrorMessage.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* <p>Because raw serialization of throwables is prohibited, you should use this message when it is necessary
3737
* to transfer some error as part of some message. See {@link MessageProcessor} for details.
3838
* <p>Currently, under the hood marshalling and unmarshalling is performed by {@link JdkMarshaller}.
39+
* <p>If the message serialization fails, wraps this error with own one.
3940
*/
4041
@SuppressWarnings({"NullableProblems", "unused"})
4142
public class ErrorMessage implements Message {
@@ -74,8 +75,22 @@ public ErrorMessage(@Nullable Throwable err) {
7475
try {
7576
return U.marshal(jdk(), err);
7677
}
77-
catch (IgniteCheckedException e) {
78-
throw new IgniteException("Unable to marshal the holding error.", e);
78+
catch (IgniteCheckedException e0) {
79+
IgniteCheckedException wrappedErr = new IgniteCheckedException(err.getMessage());
80+
81+
wrappedErr.setStackTrace(err.getStackTrace());
82+
wrappedErr.addSuppressed(e0);
83+
84+
try {
85+
return U.marshal(jdk(), wrappedErr);
86+
}
87+
catch (IgniteCheckedException e1) {
88+
IgniteException marshErr = new IgniteException("Unable to marshal the wrapping error.", e1);
89+
90+
marshErr.addSuppressed(wrappedErr);
91+
92+
throw marshErr;
93+
}
7994
}
8095
}
8196

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static CacheInvokeDirectResult lazyResult(KeyCacheObject key, Object res) {
8787
*/
8888
public CacheInvokeDirectResult(KeyCacheObject key, Throwable err) {
8989
this.key = key;
90-
this.errMsg = new ErrorMessage(err);
90+
errMsg = new ErrorMessage(err);
9191
}
9292

9393
/**

0 commit comments

Comments
 (0)