浏览代码

HDFS-2287. TestParallelRead has a small off-by-one bug. Contributed by Todd Lipcon.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22@1207711 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko 13 年之前
父节点
当前提交
4895913b59
共有 2 个文件被更改,包括 8 次插入6 次删除
  1. 2 0
      hdfs/CHANGES.txt
  2. 6 6
      hdfs/src/test/hdfs/org/apache/hadoop/hdfs/TestParallelRead.java

+ 2 - 0
hdfs/CHANGES.txt

@@ -675,6 +675,8 @@ Release 0.22.0 - Unreleased
     HDFS-2346. TestHost2NodesMap & TestReplicasMap will fail depending upon
     execution order of test methods (Laxman, Uma Maheswara Rao G via shv)
 
+    HDFS-2287. TestParallelRead has a small off-by-one bug. (todd via shv)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

+ 6 - 6
hdfs/src/test/hdfs/org/apache/hadoop/hdfs/TestParallelRead.java

@@ -109,11 +109,11 @@ public class TestParallelRead {
             pRead(startOff, len);
             bytesRead += len;
           }
-        } catch (Exception ex) {
+        } catch (Throwable t) {
           LOG.error(getName() + ": Error while testing read at " + startOff +
                     " length " + len);
           error = true;
-          fail(ex.getMessage());
+          fail(t.getMessage());
         }
       }
     }
@@ -135,8 +135,8 @@ public class TestParallelRead {
      */
     private void read(int start, int len) throws Exception {
       assertTrue(
-          "Bad args: " + start + " + " + len + " should be < " + fileSize,
-          start + len < fileSize);
+          "Bad args: " + start + " + " + len + " should be <= " + fileSize,
+          start + len <= fileSize);
       DFSInputStream dis = testInfo.dis;
 
       synchronized (dis) {
@@ -156,8 +156,8 @@ public class TestParallelRead {
      */
     private void pRead(int start, int len) throws Exception {
       assertTrue(
-          "Bad args: " + start + " + " + len + " should be < " + fileSize,
-          start + len < fileSize);
+          "Bad args: " + start + " + " + len + " should be <= " + fileSize,
+          start + len <= fileSize);
       DFSInputStream dis = testInfo.dis;
 
       byte buf[] = new byte[len];