hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r937183 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/ipc/RemoteException.java src/java/org/apache/hadoop/ipc/Server.java
Date Fri, 23 Apr 2010 08:05:30 GMT
Author: suresh
Date: Fri Apr 23 08:05:30 2010
New Revision: 937183

URL: http://svn.apache.org/viewvc?rev=937183&view=rev
Log:
HADOOP-6686. Remove redundant exception class name from the exception message for the exceptions
thrown at RPC client. Contributed by Suresh Srinivas.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RemoteException.java
    hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=937183&r1=937182&r2=937183&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri Apr 23 08:05:30 2010
@@ -7,6 +7,9 @@ Trunk (unreleased changes)
     HADOOP-6299. Reimplement the UserGroupInformation to use the OS
     specific and Kerberos JAAS login. (omalley)
 
+    HADOOP-6686. Remove redundant exception class name from the exception
+    message for the exceptions thrown at RPC client. (suresh)
+
   NEW FEATURES
 
     HADOOP-6284. Add a new parameter, HADOOP_JAVA_PLATFORM_OPTS, to

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RemoteException.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RemoteException.java?rev=937183&r1=937182&r2=937183&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RemoteException.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RemoteException.java Fri Apr 23 08:05:30
2010
@@ -88,12 +88,7 @@ public class RemoteException extends IOE
       throws Exception {
     Constructor<? extends IOException> cn = cls.getConstructor(String.class);
     cn.setAccessible(true);
-    String firstLine = this.getMessage();
-    int eol = firstLine.indexOf('\n');
-    if (eol>=0) {
-      firstLine = firstLine.substring(0, eol);
-    }
-    IOException ex = cn.newInstance(firstLine);
+    IOException ex = cn.newInstance(this.getMessage());
     ex.initCause(this);
     return ex;
   }
@@ -117,4 +112,8 @@ public class RemoteException extends IOE
     return new RemoteException(attrs.getValue("class"),
         attrs.getValue("message")); 
   }
+  
+  public String toString() {
+    return className + ": " + getMessage();
+  }
 }

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java?rev=937183&r1=937182&r2=937183&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java Fri Apr 23 08:05:30 2010
@@ -1276,6 +1276,11 @@ public abstract class Server {
             LOG.info(getName()+", call "+call+": error: " + e, e);
             errorClass = e.getClass().getName();
             error = StringUtils.stringifyException(e);
+            // Remove redundant error class name from the beginning of the stack trace
+            String exceptionHdr = errorClass + ": ";
+            if (error.startsWith(exceptionHdr)) {
+              error = error.substring(exceptionHdr.length());
+            }
           }
           CurCall.set(null);
           synchronized (call.connection.responseQueue) {



Mime
View raw message