aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-03-11 23:40:21 +0000
committerPJ Fanning <fanningpj@apache.org>2022-03-11 23:40:21 +0000
commit417f5e9a95672521d6ad85092ad57b0491292082 (patch)
tree8dc35b79078a6c4a2bc2eac1775e4d538dc69535
parent38e5040ee6a303d9fc992f69e7dd9123ae2f6834 (diff)
downloadpoi-417f5e9a95672521d6ad85092ad57b0491292082.tar.gz
poi-417f5e9a95672521d6ad85092ad57b0491292082.zip
fix issue in IOUtils.toByteArrayWithMaxLength
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898864 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/main/java/org/apache/poi/util/IOUtils.java2
1 files changed, 1 insertions, 1 deletions
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)) {