hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r380042 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java
Date Thu, 23 Feb 2006 05:16:17 GMT
Author: cutting
Date: Wed Feb 22 21:16:12 2006
New Revision: 380042

URL: http://svn.apache.org/viewcvs?rev=380042&view=rev
Log:
Fix for HADOOP-40.  Buffer position was not maintained correctly.  Contributed by Konstantin
Shvachko.

Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java?rev=380042&r1=380041&r2=380042&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java Wed Feb 22 21:16:12
2006
@@ -154,8 +154,9 @@
     // This is the only read() method called by BufferedInputStream, so we trap
     // calls to it in order to cache the position.
     public int read(byte b[], int off, int len) throws IOException {
-      int result = in.read(b, off, len);
-      position += result;
+      int result;
+      if( (result = in.read(b, off, len)) > 0 )
+        position += result;
       return result;
     }
 



Mime
View raw message