You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2021/01/06 09:10:28 UTC
svn commit: r1885189 - /poi/trunk/src/java/org/apache/poi/util/IOUtils.java
Author: centic
Date: Wed Jan 6 09:10:28 2021
New Revision: 1885189
URL: http://svn.apache.org/viewvc?rev=1885189&view=rev
Log:
Slightly adjust error message if requested allocations are too big
Modified:
poi/trunk/src/java/org/apache/poi/util/IOUtils.java
Modified: poi/trunk/src/java/org/apache/poi/util/IOUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/IOUtils.java?rev=1885189&r1=1885188&r2=1885189&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/IOUtils.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/IOUtils.java Wed Jan 6 09:10:28 2021
@@ -29,6 +29,7 @@ import java.io.PushbackInputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.util.Arrays;
+import java.util.Locale;
import java.util.zip.CRC32;
import java.util.zip.Checksum;
@@ -173,7 +174,7 @@ public final class IOUtils {
checkLength(length, maxLength);
}
- final int len = Math.min((int)length, maxLength);
+ final int len = Math.min(length, maxLength);
ByteArrayOutputStream baos = new ByteArrayOutputStream(len == Integer.MAX_VALUE ? 4096 : len);
byte[] buffer = new byte[4096];
@@ -508,12 +509,13 @@ public final class IOUtils {
}
private static void throwRFE(long length, int maxLength) {
- throw new RecordFormatException("Tried to allocate an array of length "+length +
- ", but "+ maxLength+" is the maximum for this record type.\n" +
+ throw new RecordFormatException(String.format(Locale.ROOT, "Tried to allocate an array of length %,d" +
+ ", but the maximum lenght for this record type is %,d.\n" +
"If the file is not corrupt, please open an issue on bugzilla to request \n" +
"increasing the maximum allowable size for this record type.\n"+
"As a temporary workaround, consider setting a higher override value with " +
- "IOUtils.setByteArrayMaxOverride()");
+ "IOUtils.setByteArrayMaxOverride()",
+ length, maxLength));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org