Author: szetszwo
Date: Wed Oct 28 23:30:32 2009
New Revision: 830793
URL: http://svn.apache.org/viewvc?rev=830793&view=rev
Log:
HDFS-691. Fix an overflow error in DFSClient.DFSInputStream.available().
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=830793&r1=830792&r2=830793&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Wed Oct 28 23:30:32 2009
@@ -31,8 +31,6 @@
HDFS-726. Eclipse .classpath template has outdated jar files and is
missing some new ones. (cos)
- HDFS-735. TestReadWhileWriting has wrong line termination symbols (cos)
-
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES
@@ -462,6 +460,11 @@
HDFS-625. Fix NullPointerException thrown from ListPathServlet. (suresh)
+ HDFS-735. TestReadWhileWriting has wrong line termination symbols (cos)
+
+ HDFS-691. Fix an overflow error in DFSClient.DFSInputStream.available().
+ (szetszwo)
+
Release 0.20.2 - Unreleased
IMPROVEMENTS
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java?rev=830793&r1=830792&r2=830793&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java Wed Oct 28
23:30:32 2009
@@ -2331,14 +2331,18 @@
return pos;
}
- /**
+ /** Return the size of the remaining available bytes
+ * if the size is less than or equal to {...@link Integer#MAX_VALUE},
+ * otherwise, return {...@link Integer#MAX_VALUE}.
*/
@Override
public synchronized int available() throws IOException {
if (closed) {
throw new IOException("Stream closed");
}
- return (int) (getFileLength() - pos);
+
+ final long remaining = getFileLength() - pos;
+ return remaining <= Integer.MAX_VALUE? (int)remaining: Integer.MAX_VALUE;
}
/**