From 417f5e9a95672521d6ad85092ad57b0491292082 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 11 Mar 2022 23:40:21 +0000 Subject: fix issue in IOUtils.toByteArrayWithMaxLength git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898864 13f79535-47bb-0310-9956-ffa450edef68 --- poi/src/main/java/org/apache/poi/util/IOUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poi/src/main/java/org/apache/poi/util/IOUtils.java b/poi/src/main/java/org/apache/poi/util/IOUtils.java index f5940d9555..422b337e84 100644 --- a/poi/src/main/java/org/apache/poi/util/IOUtils.java +++ b/poi/src/main/java/org/apache/poi/util/IOUtils.java @@ -225,7 +225,7 @@ public final class IOUtils { final int derivedLen = Math.min(length, derivedMaxLength); int bufferLen = isLengthKnown ? derivedLen : Math.min(4096, derivedLen); - if (bufferLen > MAX_BYTE_ARRAY_INIT_SIZE && MAX_BYTE_ARRAY_INIT_SIZE > 0) { + if (MAX_BYTE_ARRAY_INIT_SIZE > 0 && bufferLen > MAX_BYTE_ARRAY_INIT_SIZE) { bufferLen = Math.min(bufferLen, MAX_BYTE_ARRAY_INIT_SIZE); } try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream(bufferLen)) { -- cgit v1.2.3