check the buffer size
This commit is contained in:
parent
47dd00a82e
commit
22338e5eb9
|
@ -550,6 +550,8 @@ public class TestDFSIO implements Tool {
|
|||
InputStream in = (InputStream)this.stream;
|
||||
long actualSize = 0;
|
||||
while (actualSize < totalSize) {
|
||||
if(bufferSize <= 0)
|
||||
throw new IllegalArgumentException("buffer size should be positive integer.");
|
||||
int curSize = in.read(buffer, 0, bufferSize);
|
||||
if(curSize < 0) break;
|
||||
actualSize += curSize;
|
||||
|
|
Loading…
Reference in New Issue