Browse Source

HADOOP-3725. Prevent TestMiniMRMapDebugScript from swallowing exceptions.
Contributed by Steve Loughran.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@675702 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 years ago
parent
commit
5a86856c70
2 changed files with 12 additions and 11 deletions
  1. 3 0
      CHANGES.txt
  2. 9 11
      src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java

+ 3 - 0
CHANGES.txt

@@ -90,6 +90,9 @@ Trunk (unreleased changes)
     HADOOP-3711. Fixes the Streaming input parsing to properly find the 
     separator. (Amareshwari Sriramadasu via ddas)
 
+    HADOOP-3725. Prevent TestMiniMRMapDebugScript from swallowing exceptions.
+    (Steve Loughran via cdouglas)
+
 Release 0.18.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 9 - 11
src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java

@@ -21,7 +21,6 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
-import java.net.URISyntaxException;
 
 import junit.framework.TestCase;
 
@@ -159,8 +158,7 @@ public class TestMiniMRMapRedDebugScript extends TestCase {
     try {
       job = new JobClient(conf).submitJob(conf);
     } catch (IOException e) {
-    	LOG.info("Running Job failed");
-    	e.printStackTrace();
+    	LOG.info("Running Job failed", e);
     }
 
     JobID jobId = job.getID();
@@ -182,7 +180,7 @@ public class TestMiniMRMapRedDebugScript extends TestCase {
    * the output of debug out log. 
    *
    */
-  public void testMapDebugScript(){
+  public void testMapDebugScript() throws Exception {
     try {
       
       // create configuration, dfs, file system and mapred cluster 
@@ -207,10 +205,7 @@ public class TestMiniMRMapRedDebugScript extends TestCase {
       
       // Assert the output of debug script.
       assertEquals("Test Script\nBailing out", result);
-      
-    } catch(Exception e) {
-      e.printStackTrace();
-      fail("Exception in testing mapred debug script");
+
     } finally {  
       // close file system and shut down dfs and mapred cluster
       try {
@@ -224,15 +219,18 @@ public class TestMiniMRMapRedDebugScript extends TestCase {
           mr.shutdown();
         }
       } catch (IOException ioe) {
-        LOG.info("IO exception in closing file system)" );
-        ioe.printStackTrace();        			
+        LOG.info("IO exception in closing file system:"+ioe.getMessage(), ioe);
       }
     }
   }
 
   public static void main(String args[]){
     TestMiniMRMapRedDebugScript tmds = new TestMiniMRMapRedDebugScript();
-    tmds.testMapDebugScript();
+    try {
+      tmds.testMapDebugScript();
+    } catch (Exception e) {
+      LOG.error("Exception in test: "+e.getMessage(), e);
+    }
   }
   
 }