MAPREDUCE-7102. Fix TestJavaSerialization for Windows due a mismatch line 
separator. Contributed by Giovanni Matteo Fumarola.

(cherry picked from commit a804b7c9d2986556c91c1741c1ae7ac2b9c579f3)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fce54631
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fce54631
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fce54631

Branch: refs/remotes/origin/branch-3.1
Commit: fce54631c5ab79ce335d28816a69f8395a803c78
Parents: 90060d5
Author: Inigo Goiri <inigo...@apache.org>
Authored: Sat Jun 2 20:25:42 2018 -0700
Committer: Inigo Goiri <inigo...@apache.org>
Committed: Sat Jun 2 20:26:17 2018 -0700

----------------------------------------------------------------------
 .../hadoop/mapred/TestJavaSerialization.java    | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fce54631/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestJavaSerialization.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestJavaSerialization.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestJavaSerialization.java
index a787e68..e5ef4d2 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestJavaSerialization.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestJavaSerialization.java
@@ -91,6 +91,8 @@ public class TestJavaSerialization {
     wr.write("b a\n");
     wr.close();
   }
+
+  @SuppressWarnings("deprecation")
   @Test
   public void testMapReduceJob() throws Exception {
 
@@ -131,16 +133,17 @@ public class TestJavaSerialization {
         FileUtil.stat2Paths(fs.listStatus(OUTPUT_DIR,
           new Utils.OutputFileUtils.OutputFilesFilter()));
     assertEquals(1, outputFiles.length);
-    InputStream is = fs.open(outputFiles[0]);
-    String reduceOutput = org.apache.commons.io.IOUtils.toString(is);
-    String[] lines = reduceOutput.split(System.getProperty("line.separator"));
-    assertEquals("Unexpected output; received output '" + reduceOutput + "'",
-      "a\t1", lines[0]);
-    assertEquals("Unexpected output; received output '" + reduceOutput + "'",
-      "b\t1", lines[1]);
-    assertEquals("Reduce output has extra lines; output is '" + reduceOutput
-        + "'", 2, lines.length);
-    is.close();
+    try (InputStream is = fs.open(outputFiles[0])) {
+      String reduceOutput = org.apache.commons.io.IOUtils.toString(is);
+      String[] lines = reduceOutput.split("\n");
+      assertEquals("Unexpected output; received output '" + reduceOutput + "'",
+          "a\t1", lines[0]);
+      assertEquals("Unexpected output; received output '" + reduceOutput + "'",
+          "b\t1", lines[1]);
+      assertEquals(
+          "Reduce output has extra lines; output is '" + reduceOutput + "'", 2,
+          lines.length);
+    }
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to