diff --git a/CHANGES.txt b/CHANGES.txt index a92d930beb..34be5b663b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/java/org/apache/hadoop/ipc/RemoteException.java b/src/java/org/apache/hadoop/ipc/RemoteException.java index 214b2f66b6..01e8dbfc06 100644 --- a/src/java/org/apache/hadoop/ipc/RemoteException.java +++ b/src/java/org/apache/hadoop/ipc/RemoteException.java @@ -88,12 +88,7 @@ public class RemoteException extends IOException { throws Exception { Constructor 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 IOException { return new RemoteException(attrs.getValue("class"), attrs.getValue("message")); } + + public String toString() { + return className + ": " + getMessage(); + } } diff --git a/src/java/org/apache/hadoop/ipc/Server.java b/src/java/org/apache/hadoop/ipc/Server.java index e69d079e2f..76068c9cab 100644 --- a/src/java/org/apache/hadoop/ipc/Server.java +++ b/src/java/org/apache/hadoop/ipc/Server.java @@ -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) {