You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by mc...@apache.org on 2005/09/01 16:54:40 UTC

svn commit: r265742 - /lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java

Author: mc
Date: Thu Sep  1 07:54:39 2005
New Revision: 265742

URL: http://svn.apache.org/viewcvs?rev=265742&view=rev
Log:

  We used to sometimes overrun the end of a block by not
checking how many bytes are available.  This solves the
problem.



Modified:
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java

Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java?rev=265742&r1=265741&r2=265742&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java Thu Sep  1 07:54:39 2005
@@ -437,7 +437,7 @@
                 if (pos > blockEnd) {
                     blockSeekTo(pos);
                 }
-                int result = blockStream.read(buf, off, len);
+                int result = blockStream.read(buf, off, Math.min(len, (int) (blockEnd - pos + 1)));
                 if (result >= 0) {
                     pos += result;
                 }