You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2008/08/13 00:12:10 UTC

svn commit: r685342 - in /hadoop/core/trunk: CHANGES.txt src/core/org/apache/hadoop/ipc/Client.java src/test/org/apache/hadoop/ipc/TestIPC.java

Author: omalley
Date: Tue Aug 12 15:12:10 2008
New Revision: 685342

URL: http://svn.apache.org/viewvc?rev=685342&view=rev
Log:
HADOOP-3844. Include message of local exception in RPC client failures.
(Steve Loughran via omalley)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/core/org/apache/hadoop/ipc/Client.java
    hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestIPC.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=685342&r1=685341&r2=685342&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Aug 12 15:12:10 2008
@@ -178,6 +178,9 @@
     HADOOP-3852. Add ShellCommandExecutor.toString method to make nicer
     error messages. (Steve Loughran via omalley)
 
+    HADOOP-3844. Include message of local exception in RPC client failures.
+    (Steve Loughran via omalley)
+
   OPTIMIZATIONS
 
     HADOOP-3556. Removed lock contention in MD5Hash by changing the 

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/ipc/Client.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/ipc/Client.java?rev=685342&r1=685341&r2=685342&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/ipc/Client.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/ipc/Client.java Tue Aug 12 15:12:10 2008
@@ -708,7 +708,9 @@
           throw call.error;
         } else { // local exception
           throw (IOException)new IOException(
-              "Call failed on local exception").initCause(call.error);
+              "Call to "+ addr + " failed on local exception: "
+                      + call.error.getMessage())
+                  .initCause(call.error);
         }
       } else {
         return call.value;

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestIPC.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestIPC.java?rev=685342&r1=685341&r2=685342&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestIPC.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestIPC.java Tue Aug 12 15:12:10 2008
@@ -211,16 +211,25 @@
   public void testStandAloneClient() throws Exception {
     testParallel(10, false, 2, 4, 2, 4, 100);
     Client client = new Client(LongWritable.class, conf);
-    boolean hasException = false;
+    InetSocketAddress address = new InetSocketAddress("127.0.0.1", 10);
     try {
-      client.call(new LongWritable(RANDOM.nextLong()), 
-          new InetSocketAddress("127.0.0.1", 10));
+      client.call(new LongWritable(RANDOM.nextLong()),
+              address);
+      fail("Expected an exception to have been thrown");
     } catch (IOException e) {
-      hasException = true;
+      String message = e.getMessage();
+      String addressText = address.toString();
+      assertTrue("Did not find "+addressText+" in "+message,
+              message.contains(addressText));
+      Throwable cause=e.getCause();
+      assertNotNull("No nested exception in "+e,cause);
+      String causeText=cause.getMessage();
+      assertTrue("Did not find " + causeText + " in " + message,
+              message.contains(causeText));
     }
-    assertTrue (hasException);
   }
 
+
   public static void main(String[] args) throws Exception {
 
     //new TestIPC("test").testSerial(5, false, 2, 10, 1000);