From 22338e5eb998482e3ecc0bdf91f6d4f5352e0f1b Mon Sep 17 00:00:00 2001 From: lqjaclee Date: Thu, 27 Dec 2018 22:01:39 +0800 Subject: [PATCH] check the buffer size --- .../src/test/java/org/apache/hadoop/fs/TestDFSIO.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java index 10709bec0fe..97174479358 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java @@ -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;