From 6f0e864d61b5f94edac51bbe90310326e357750b Mon Sep 17 00:00:00 2001 From: Robert Kanter Date: Thu, 26 Mar 2015 11:00:20 -0700 Subject: [PATCH] YARN-3400. [JDK 8] Build Failure due to unreported exceptions in RPCUtil (rkanter) (cherry picked from commit 87130bf6b22f538c5c26ad5cef984558a8117798) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/yarn/ipc/RPCUtil.java | 23 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 133083c1508..0597518231f 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -60,6 +60,9 @@ Release 2.8.0 - UNRELEASED YARN-3383. AdminService should use "warn" instead of "info" to log exception when operation fails. (Li Lu via wangda) + YARN-3400. [JDK 8] Build Failure due to unreported exceptions in + RPCUtil (rkanter) + Release 2.7.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java index ada066948aa..1086ff03f52 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java @@ -70,6 +70,21 @@ public class RPCUtil { } } + private static T instantiateYarnException( + Class cls, RemoteException re) throws RemoteException { + return instantiateException(cls, re); + } + + private static T instantiateIOException( + Class cls, RemoteException re) throws RemoteException { + return instantiateException(cls, re); + } + + private static T instantiateRuntimeException( + Class cls, RemoteException re) throws RemoteException { + return instantiateException(cls, re); + } + /** * Utility method that unwraps and returns appropriate exceptions. * @@ -94,17 +109,17 @@ public class RPCUtil { // Assume this to be a new exception type added to YARN. This isn't // absolutely correct since the RPC layer could add an exception as // well. - throw instantiateException(YarnException.class, re); + throw instantiateYarnException(YarnException.class, re); } if (YarnException.class.isAssignableFrom(realClass)) { - throw instantiateException( + throw instantiateYarnException( realClass.asSubclass(YarnException.class), re); } else if (IOException.class.isAssignableFrom(realClass)) { - throw instantiateException(realClass.asSubclass(IOException.class), + throw instantiateIOException(realClass.asSubclass(IOException.class), re); } else if (RuntimeException.class.isAssignableFrom(realClass)) { - throw instantiateException( + throw instantiateRuntimeException( realClass.asSubclass(RuntimeException.class), re); } else { throw re;