hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077663 - /hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/fs/TestDFSIO.java
Date Fri, 04 Mar 2011 04:41:40 GMT
Author: omalley
Date: Fri Mar  4 04:41:40 2011
New Revision: 1077663

URL: http://svn.apache.org/viewvc?rev=1077663&view=rev
Log:
commit c239ea635813b37d096cb8446c5c7dc55c62afb5
Author: Hong Tang <htang@yahoo-inc.com>
Date:   Fri Sep 3 01:00:17 2010 -0700

    MAPREDUCE-2023. TestDFSIO read test may not read specified bytes. From https://issues.apache.org/jira/secure/attachment/12453758/mr-2023-yahoo-hadoop-20.1xx.patch.
(htang)
    
    +++ b/YAHOO-CHANGES.txt
    +    MAPREDUCE-2023. TestDFSIO read test may not read specified bytes. (htang)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/fs/TestDFSIO.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/fs/TestDFSIO.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/fs/TestDFSIO.java?rev=1077663&r1=1077662&r2=1077663&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/fs/TestDFSIO.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/fs/TestDFSIO.java
Fri Mar  4 04:41:40 2011
@@ -272,10 +272,11 @@ public class TestDFSIO extends Configure
       totalSize *= MEGA;
       // open file
       DataInputStream in = fs.open(new Path(DATA_DIR, name));
+      long actualSize = 0;
       try {
-        long actualSize = 0;
-        for(int curSize = bufferSize; curSize == bufferSize;) {
-          curSize = in.read(buffer, 0, bufferSize);
+        while (actualSize < totalSize) {
+          int curSize = in.read(buffer, 0, bufferSize);
+          if (curSize < 0) break;
           actualSize += curSize;
           reporter.setStatus("reading " + name + "@" + 
                              actualSize + "/" + totalSize 
@@ -284,7 +285,7 @@ public class TestDFSIO extends Configure
       } finally {
         in.close();
       }
-      return Long.valueOf(totalSize);
+      return Long.valueOf(actualSize);
     }
   }
 



Mime
View raw message