hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tgra...@apache.org
Subject svn commit: r1441585 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: CHANGES.txt hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java
Date Fri, 01 Feb 2013 19:06:12 GMT
Author: tgraves
Date: Fri Feb  1 19:06:11 2013
New Revision: 1441585

URL: http://svn.apache.org/viewvc?rev=1441585&view=rev
Log:
MAPREDUCE-4969. TestKeyValueTextInputFormat test fails with Open JDK 7. (Arpit Agarwal via
tgraves)

Modified:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1441585&r1=1441584&r2=1441585&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Fri Feb  1 19:06:11
2013
@@ -34,6 +34,9 @@ Release 0.23.7 - UNRELEASED
     MAPREDUCE-4470. Fix TestCombineFileInputFormat.testForEmptyFile (ikatsov 
     via tgraves)
 
+    MAPREDUCE-4969. TestKeyValueTextInputFormat test fails with Open JDK 7.
+    (Arpit Agarwal via tgraves)
+
 Release 0.23.6 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java?rev=1441585&r1=1441584&r2=1441585&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java
Fri Feb  1 19:06:11 2013
@@ -136,32 +136,47 @@ public class TestKeyValueTextInputFormat
   }
   
   public void testUTF8() throws Exception {
-    LineReader in = makeStream("abcd\u20acbdcd\u20ac");
-    Text line = new Text();
-    in.readLine(line);
-    assertEquals("readLine changed utf8 characters", 
-                 "abcd\u20acbdcd\u20ac", line.toString());
-    in = makeStream("abc\u200axyz");
-    in.readLine(line);
-    assertEquals("split on fake newline", "abc\u200axyz", line.toString());
+    LineReader in = null;
+
+    try {
+      in = makeStream("abcd\u20acbdcd\u20ac");
+      Text line = new Text();
+      in.readLine(line);
+      assertEquals("readLine changed utf8 characters",
+                   "abcd\u20acbdcd\u20ac", line.toString());
+      in = makeStream("abc\u200axyz");
+      in.readLine(line);
+      assertEquals("split on fake newline", "abc\u200axyz", line.toString());
+    } finally {
+      if (in != null) {
+        in.close();
+      }
+    }
   }
 
   public void testNewLines() throws Exception {
-    LineReader in = makeStream("a\nbb\n\nccc\rdddd\r\neeeee");
-    Text out = new Text();
-    in.readLine(out);
-    assertEquals("line1 length", 1, out.getLength());
-    in.readLine(out);
-    assertEquals("line2 length", 2, out.getLength());
-    in.readLine(out);
-    assertEquals("line3 length", 0, out.getLength());
-    in.readLine(out);
-    assertEquals("line4 length", 3, out.getLength());
-    in.readLine(out);
-    assertEquals("line5 length", 4, out.getLength());
-    in.readLine(out);
-    assertEquals("line5 length", 5, out.getLength());
-    assertEquals("end of file", 0, in.readLine(out));
+    LineReader in = null;
+    try {
+      in = makeStream("a\nbb\n\nccc\rdddd\r\neeeee");
+      Text out = new Text();
+      in.readLine(out);
+      assertEquals("line1 length", 1, out.getLength());
+      in.readLine(out);
+      assertEquals("line2 length", 2, out.getLength());
+      in.readLine(out);
+      assertEquals("line3 length", 0, out.getLength());
+      in.readLine(out);
+      assertEquals("line4 length", 3, out.getLength());
+      in.readLine(out);
+      assertEquals("line5 length", 4, out.getLength());
+      in.readLine(out);
+      assertEquals("line5 length", 5, out.getLength());
+      assertEquals("end of file", 0, in.readLine(out));
+    } finally {
+      if (in != null) {
+        in.close();
+      }
+    }
   }
   
   private static void writeFile(FileSystem fs, Path name, 
@@ -183,14 +198,21 @@ public class TestKeyValueTextInputFormat
                                       InputSplit split, 
                                       JobConf job) throws IOException {
     List<Text> result = new ArrayList<Text>();
-    RecordReader<Text, Text> reader = format.getRecordReader(split, job,
-                                                 voidReporter);
-    Text key = reader.createKey();
-    Text value = reader.createValue();
-    while (reader.next(key, value)) {
-      result.add(value);
-      value = reader.createValue();
-    }
+    RecordReader<Text, Text> reader = null;
+
+    try {
+      reader = format.getRecordReader(split, job, voidReporter);
+      Text key = reader.createKey();
+      Text value = reader.createValue();
+      while (reader.next(key, value)) {
+        result.add(value);
+        value = (Text) reader.createValue();
+      }   
+    } finally {
+      if (reader != null) {
+        reader.close();
+      }   
+    }   
     return result;
   }
   



Mime
View raw message