From 87130bf6b22f538c5c26ad5cef984558a8117798 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) --- 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 905b414b8f..d6ded778af 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -108,6 +108,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 ada066948a..1086ff03f5 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 @@ private static T instantiateException( } } + 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 static Void unwrapAndThrowException(ServiceException se) // 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;