From 969a0950ff87907fb27a96392cf3c93ad8dcbb9d Mon Sep 17 00:00:00 2001 From: Anshu Singh Date: Tue, 28 Jul 2026 12:16:59 +0530 Subject: [PATCH] HADOOP-18814. Direct class cast causes ClassCastException in TestRPC#testReaderExceptions --- .../src/test/java/org/apache/hadoop/ipc/TestRPC.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java index 77374429ee3208..3bf6acae292e5c 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java @@ -1943,8 +1943,12 @@ public RpcStatusProto getRpcStatusProto() { proxy.ping(null, newEmptyRequest()); fail(reqName + " didn't fail"); } catch (ServiceException e) { - RemoteException re = (RemoteException)e.getCause(); - assertEquals(expectedIOE, re.unwrapRemoteException(), reqName); + if (e.getCause() instanceof RemoteException) { + RemoteException re = (RemoteException)e.getCause(); + assertEquals(expectedIOE, re.unwrapRemoteException(), reqName); + } else { + throw e; + } } // check authorizations to ensure new connection when expected, // then conclusively determine if connections are disconnected