]> source.dussan.org Git - poi.git/commitdiff
fix issue in IOUtils.toByteArrayWithMaxLength
authorPJ Fanning <fanningpj@apache.org>
Sat, 12 Mar 2022 09:31:44 +0000 (09:31 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sat, 12 Mar 2022 09:31:44 +0000 (09:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898871 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/util/IOUtils.java

index 34fac68a58e4b61a3d52ffa4159ea4a1245cd086..7e1fef89902e775d2df82916cd38cda46fdc9f96 100644 (file)
@@ -406,7 +406,7 @@ public final class IOUtils {
         long totalCount = 0;
         int readBytes = -1;
         do {
-            int todoBytes = (int)((limit < 0) ? buff.length : Math.min(limit-totalCount, buff.length));
+            int todoBytes = (int)((limit < 0) ? DEFAULT_BUFFER_SIZE : Math.min(limit-totalCount, DEFAULT_BUFFER_SIZE));
             if (todoBytes > 0) {
                 readBytes = inp.read(buff, 0, todoBytes);
                 if (readBytes > 0) {