Author: cutting
Date: Thu Nov 3 13:18:05 2005
New Revision: 330640
URL: http://svn.apache.org/viewcvs?rev=330640&view=rev
Log:
Fix a buggy cast when files are longer than Integer.MAX_VALUE, and
improve some diagnostics.
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java
URL:
http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java?rev=330640&r1=330639&r2=330640&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java
(original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java
Thu Nov 3 13:18:05 2005
@@ -366,8 +366,11 @@
while (anotherChunk) {
while (len > 0) {
- int bytesRead = in.read(buf, 0,
Math.min(buf.length, (int) len));
- if (bytesRead >= 0) {
+ int bytesRead = in.read(buf, 0,
(int)Math.min(buf.length, len));
+ if (bytesRead < 0) {
+ throw new EOFException("EOF
reading from "+s.toString());
+ }
+ if (bytesRead > 0) {
try {
out.write(buf, 0,
bytesRead);
} catch (IOException iex) {
@@ -393,8 +396,8 @@
}
}
}
+ len -= bytesRead;
}
- len -= bytesRead;
}
if (encodingType ==
RUNLENGTH_ENCODING) {
@@ -556,7 +559,7 @@
in.close();
}
} catch (IOException ie) {
- ie.printStackTrace();
+ LOG.log(Level.WARNING, "DataXCeiver", ie);
} finally {
try {
s.close();