hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject svn commit: r1492001 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/ hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/ipc/
Date Tue, 11 Jun 2013 22:35:23 GMT
Author: sseth
Date: Tue Jun 11 22:35:22 2013
New Revision: 1492001

URL: http://svn.apache.org/r1492001
Log:
merge TEZ-731 from trunk. RPCUtil.unwrapAndThrowException should unwrap remote RuntimeExceptions.
Contributed by Zhijie Shen.

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/ipc/TestRPCUtil.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1492001&r1=1492000&r2=1492001&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Tue Jun 11 22:35:22 2013
@@ -292,6 +292,9 @@ Release 2.1.0-beta - UNRELEASED
     YARN-737. Throw some specific exceptions directly instead of wrapping them
     in YarnException. (Jian He via sseth)
 
+    YARN-731. RPCUtil.unwrapAndThrowException should unwrap remote
+    RuntimeExceptions. (Zhijie Shen via sseth)
+
   OPTIMIZATIONS
 
     YARN-512. Log aggregation root directory check is more expensive than it

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java?rev=1492001&r1=1492000&r2=1492001&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
Tue Jun 11 22:35:22 2013
@@ -101,6 +101,9 @@ public class RPCUtil {
         } else if (IOException.class.isAssignableFrom(realClass)) {
           throw instantiateException(realClass.asSubclass(IOException.class),
               re);
+        } else if (RuntimeException.class.isAssignableFrom(realClass)) {
+          throw instantiateException(
+              realClass.asSubclass(RuntimeException.class), re);
         } else {
           throw re;
         }
@@ -110,6 +113,9 @@ public class RPCUtil {
       } else if (cause instanceof IOException) {
         // RPC Client exception.
         throw (IOException) cause;
+      } else if (cause instanceof RuntimeException) {
+        // RPC RuntimeException
+        throw (RuntimeException) cause;
       } else {
         // Should not be generated.
         throw new IOException(se);

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/ipc/TestRPCUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/ipc/TestRPCUtil.java?rev=1492001&r1=1492000&r2=1492001&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/ipc/TestRPCUtil.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/ipc/TestRPCUtil.java
Tue Jun 11 22:35:22 2013
@@ -65,6 +65,12 @@ public class TestRPCUtil {
   }
 
   @Test
+  public void testRemoteRuntimeExceptionUnwrapping() {
+    Class<? extends Throwable> exception = NullPointerException.class;
+    verifyRemoteExceptionUnwrapping(exception, exception.getName());
+  }
+
+  @Test
   public void testUnexpectedRemoteExceptionUnwrapping() {
     // Non IOException, YarnException thrown by the remote side.
     Class<? extends Throwable> exception = Exception.class;
@@ -110,6 +116,23 @@ public class TestRPCUtil {
     Assert.assertTrue(t.getMessage().contains(message));
   }
 
+  @Test
+  public void testRPCRuntimeExceptionUnwrapping() {
+    String message = "RPCRuntimeExceptionUnwrapping";
+    RuntimeException re = new NullPointerException(message);
+    ServiceException se = new ServiceException(re);
+
+    Throwable t = null;
+    try {
+      RPCUtil.unwrapAndThrowException(se);
+    }  catch (Throwable thrown) {
+      t = thrown;
+    }
+
+    Assert.assertTrue(NullPointerException.class.isInstance(t));
+    Assert.assertTrue(t.getMessage().contains(message));
+  }
+
   private void verifyRemoteExceptionUnwrapping(
       Class<? extends Throwable> expectedLocalException,
       String realExceptionClassName) {



Mime
View raw message