check the buffer size

This commit is contained in:
lqjaclee 2018-12-27 22:01:39 +08:00
parent 47dd00a82e
commit 22338e5eb9

View File

@ -550,6 +550,8 @@ public Long doIO(Reporter reporter,
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;