check the buffer size

This commit is contained in:
lqjaclee 2018-12-27 22:01:39 +08:00
parent 47dd00a82e
commit 22338e5eb9
1 changed files with 2 additions and 0 deletions

View File

@ -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;