diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 34967a44698..546ca6e3f5c 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -232,6 +232,8 @@ Release 2.0.3-alpha - Unreleased HADOOP-8806. libhadoop.so: dlopen should be better at locating libsnappy.so, etc. (Colin Patrick McCabe via eli) + HADOOP-8812. ExitUtil#terminate should print Exception#toString. (eli) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ExitUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ExitUtil.java index 54a96bbe00a..4d82fd272b5 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ExitUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ExitUtil.java @@ -17,9 +17,6 @@ */ package org.apache.hadoop.util; -import java.io.PrintWriter; -import java.io.StringWriter; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; @@ -104,10 +101,7 @@ public final class ExitUtil { * @throws ExitException if System.exit is disabled for test purposes */ public static void terminate(int status, Throwable t) throws ExitException { - StringWriter sw = new StringWriter(); - t.printStackTrace(new PrintWriter(sw)); - terminate(status, "Fatal exception with message " + t.getMessage() + - "\nstack trace\n" + sw.toString()); + terminate(status, StringUtils.stringifyException(t)); } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java index fe874a8295a..5df69765893 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java @@ -31,9 +31,7 @@ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; -import java.io.PrintWriter; import java.io.RandomAccessFile; -import java.io.StringWriter; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; @@ -1229,10 +1227,8 @@ public class TestEditLog { } } catch (IOException e) { } catch (Throwable t) { - StringWriter sw = new StringWriter(); - t.printStackTrace(new PrintWriter(sw)); - fail("caught non-IOException throwable with message " + - t.getMessage() + "\nstack trace\n" + sw.toString()); + fail("Caught non-IOException throwable " + + StringUtils.stringifyException(t)); } } finally { if ((elfos != null) && (elfos.isOpen()))