This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new 9c15195241 more methods names in exceptions (#1119)
9c15195241 is described below
commit 9c151952419df06987ffd993317ee9e5f76b8513
Author: PJ Fanning <[email protected]>
AuthorDate: Thu Jun 4 21:52:42 2026 +0100
more methods names in exceptions (#1119)
---
.../poi/poifs/crypt/ChunkedCipherInputStream.java | 6 ++++--
.../poi/poifs/crypt/ChunkedCipherOutputStream.java | 6 ++++--
.../org/apache/poi/poifs/crypt/CryptoFunctions.java | 4 ++--
.../org/apache/poi/poifs/crypt/DataSpaceMapUtils.java | 3 ++-
.../apache/poi/poifs/crypt/agile/AgileEncryptor.java | 14 ++++++++------
.../main/java/org/apache/poi/poifs/dev/POIFSDump.java | 4 +++-
.../org/apache/poi/poifs/filesystem/POIFSDocument.java | 7 +++++--
.../apache/poi/poifs/filesystem/POIFSFileSystem.java | 7 +++++--
.../org/apache/poi/poifs/macros/VBAMacroReader.java | 17 ++++++++++++++---
.../org/apache/poi/poifs/property/PropertyTable.java | 3 ++-
.../java/org/apache/poi/poifs/storage/HeaderBlock.java | 3 ++-
.../org/apache/poi/ss/extractor/EmbeddedExtractor.java | 3 ++-
.../main/java/org/apache/poi/ss/formula/Formula.java | 4 +++-
.../poi/ss/formula/function/FunctionMetadataReader.java | 3 ++-
.../main/java/org/apache/poi/util/LZWDecompresser.java | 3 ++-
poi/src/main/java/org/apache/poi/util/StringUtil.java | 5 +++--
16 files changed, 63 insertions(+), 29 deletions(-)
diff --git
a/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
b/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
index 9a64146440..4b2b81abed 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
@@ -54,8 +54,10 @@ public abstract class ChunkedCipherInputStream extends
LittleEndianInputStream {
this.pos = initialPos;
this.chunkSize = chunkSize;
int cs = chunkSize == -1 ? 4096 : chunkSize;
- this.chunk = IOUtils.safelyAllocate(cs,
CryptoFunctions.MAX_RECORD_LENGTH);
- this.plain = IOUtils.safelyAllocate(cs,
CryptoFunctions.MAX_RECORD_LENGTH);
+ this.chunk = IOUtils.safelyAllocate(cs,
CryptoFunctions.getMaxRecordLength(),
+ "CryptoFunctions.setMaxRecordLength()");
+ this.plain = IOUtils.safelyAllocate(cs,
CryptoFunctions.getMaxRecordLength(),
+ "CryptoFunctions.setMaxRecordLength()");
this.chunkBits = Integer.bitCount(chunk.length-1);
this.lastIndex = Math.toIntExact(pos >> chunkBits);
this.cipher = initCipherForBlock(null, lastIndex);
diff --git
a/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
b/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
index 32112d4bf6..a5b6bee158 100644
---
a/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
+++
b/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
@@ -67,7 +67,8 @@ public abstract class ChunkedCipherOutputStream extends
FilterOutputStream {
super(null);
this.chunkSize = chunkSize;
int cs = chunkSize == STREAMING ? 4096 : chunkSize;
- this.chunk = IOUtils.safelyAllocate(cs,
CryptoFunctions.MAX_RECORD_LENGTH);
+ this.chunk = IOUtils.safelyAllocate(cs,
CryptoFunctions.getMaxRecordLength(),
+ "CryptoFunctions.setMaxRecordLength()");
this.plainByteFlags = new SparseBitSet(cs);
this.chunkBits = Integer.bitCount(cs-1);
this.fileOut = TempFile.createTempFile("encrypted_package", "crypt");
@@ -80,7 +81,8 @@ public abstract class ChunkedCipherOutputStream extends
FilterOutputStream {
super(stream);
this.chunkSize = chunkSize;
int cs = chunkSize == STREAMING ? 4096 : chunkSize;
- this.chunk = IOUtils.safelyAllocate(cs,
CryptoFunctions.MAX_RECORD_LENGTH);
+ this.chunk = IOUtils.safelyAllocate(cs,
CryptoFunctions.getMaxRecordLength(),
+ "CryptoFunctions.setMaxRecordLength()");
this.plainByteFlags = new SparseBitSet(cs);
this.chunkBits = Integer.bitCount(cs-1);
this.fileOut = null;
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
b/poi/src/main/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
index 9a91165660..e37045a171 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
@@ -48,7 +48,7 @@ public final class CryptoFunctions {
//arbitrarily selected; may need to increase
private static final int DEFAULT_MAX_RECORD_LENGTH = 100_000;
- static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
/**
* @param length the max record length allowed for CryptoFunctions
@@ -308,7 +308,7 @@ public final class CryptoFunctions {
private static byte[] getBlockX(byte[] hash, int size, byte fill) {
if (hash.length == size) return hash;
- byte[] result = IOUtils.safelyAllocate(size, MAX_RECORD_LENGTH);
+ byte[] result = IOUtils.safelyAllocate(size, MAX_RECORD_LENGTH,
"CryptoFunctions.setMaxRecordLength()");
Arrays.fill(result, fill);
System.arraycopy(hash, 0, result, 0, Math.min(result.length,
hash.length));
return result;
diff --git
a/poi/src/main/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
b/poi/src/main/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
index bcbebd7ed6..54b3caafc9 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
@@ -330,7 +330,8 @@ public class DataSpaceMapUtils {
return length == 0 ? null : "";
}
- byte[] data = IOUtils.safelyAllocate(length,
CryptoFunctions.MAX_RECORD_LENGTH);
+ byte[] data = IOUtils.safelyAllocate(length,
CryptoFunctions.getMaxRecordLength(),
+ "CryptoFunctions.setMaxRecordLength()");
is.readFully(data);
// Padding (variable): A set of bytes that MUST be of correct size
such that the size of the UTF-8-LP-P4
diff --git
a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
index 17a03d8ebe..559d007c52 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
@@ -78,6 +78,8 @@ public class AgileEncryptor extends Encryptor {
pwHash = (other.pwHash == null) ? null : other.pwHash.clone();
}
+ private static final String SETTER =
"CryptoFunctions.setMaxRecordLength()";
+
@Override
public void confirmPassword(String password) {
// see [MS-OFFCRYPTO] - 2.3.3 EncryptionVerifier
@@ -86,12 +88,12 @@ public class AgileEncryptor extends Encryptor {
int keySize = header.getKeySize()/8;
int hashSize = header.getHashAlgorithm().hashSize;
- int maxLen = CryptoFunctions.getMaxRecordLength();
- byte[] newVerifierSalt = IOUtils.safelyAllocate(blockSize, maxLen)
- , newVerifier = IOUtils.safelyAllocate(blockSize, maxLen)
- , newKeySalt = IOUtils.safelyAllocate(blockSize, maxLen)
- , newKeySpec = IOUtils.safelyAllocate(keySize, maxLen)
- , newIntegritySalt = IOUtils.safelyAllocate(hashSize, maxLen);
+ final int maxLen = CryptoFunctions.getMaxRecordLength();
+ byte[] newVerifierSalt = IOUtils.safelyAllocate(blockSize, maxLen,
SETTER)
+ , newVerifier = IOUtils.safelyAllocate(blockSize, maxLen, SETTER)
+ , newKeySalt = IOUtils.safelyAllocate(blockSize, maxLen, SETTER)
+ , newKeySpec = IOUtils.safelyAllocate(keySize, maxLen, SETTER)
+ , newIntegritySalt = IOUtils.safelyAllocate(hashSize, maxLen,
SETTER);
// using a java.security.SecureRandom (and avoid allocating a new
SecureRandom for each random number needed).
SecureRandom r = RandomSingleton.getInstance();
diff --git a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
index 20db54a6c0..c06647c41f 100644
--- a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
+++ b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSDump.java
@@ -126,7 +126,9 @@ public final class POIFSDump {
try (OutputStream out = Files.newOutputStream(file.toPath())) {
POIFSStream stream = new POIFSStream(fs, startBlock);
- byte[] b = IOUtils.safelyAllocate(fs.getBigBlockSize(),
POIFSFileSystem.getMaxRecordLength());
+ byte[] b = IOUtils.safelyAllocate(fs.getBigBlockSize(),
+ POIFSFileSystem.getMaxRecordLength(),
+ "POIFSFileSystem.setMaxRecordLength()");
for (ByteBuffer bb : stream) {
int len = bb.remaining();
bb.get(b);
diff --git
a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
index a8d3bd7d10..cf8ce464a7 100644
--- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
+++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
@@ -143,7 +143,9 @@ public final class POIFSDocument implements POIFSViewable,
Iterable<ByteBuffer>
int usedInBlock = Math.toIntExact(length % _block_size);
if (usedInBlock != 0 && usedInBlock != _block_size) {
int toBlockEnd = _block_size - usedInBlock;
- byte[] padding = IOUtils.safelyAllocate(toBlockEnd,
POIFSFileSystem.getMaxRecordLength());
+ byte[] padding = IOUtils.safelyAllocate(toBlockEnd,
+ POIFSFileSystem.getMaxRecordLength(),
+ "POIFSFileSystem.setMaxRecordLength()");
Arrays.fill(padding, (byte) 0xFF);
os.write(padding);
}
@@ -208,7 +210,8 @@ public final class POIFSDocument implements POIFSViewable,
Iterable<ByteBuffer>
if (getSize() > 0) {
// Get all the data into a single array
- byte[] data = IOUtils.safelyAllocate(getSize(),
POIFSFileSystem.getMaxRecordLength());
+ byte[] data = IOUtils.safelyAllocate(getSize(),
POIFSFileSystem.getMaxRecordLength(),
+ "POIFSFileSystem.getMaxRecordLength()");
int offset = 0;
for (ByteBuffer buffer : _stream) {
int length = Math.min(_block_size, data.length - offset);
diff --git
a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
index 9d373d2448..be207a9e50 100644
--- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
+++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
@@ -48,6 +48,7 @@ import org.apache.poi.poifs.property.PropertyTable;
import org.apache.poi.poifs.storage.BATBlock;
import org.apache.poi.poifs.storage.BATBlock.BATBlockAndIndex;
import org.apache.poi.poifs.storage.HeaderBlock;
+import org.apache.poi.util.ArrayUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
@@ -127,7 +128,9 @@ public class POIFSFileSystem extends BlockStore
// Data needs to initially hold just the header block,
// a single bat block, and an empty properties section
long blockSize = Math.multiplyExact(bigBlockSize.getBigBlockSize(),
3L);
- _data = new
ByteArrayBackedDataSource(IOUtils.safelyAllocate(blockSize, MAX_RECORD_LENGTH));
+ _data = new ByteArrayBackedDataSource(
+ IOUtils.safelyAllocate(blockSize, MAX_RECORD_LENGTH,
+ "POIFSFileSystem.getMaxRecordLength()"));
}
/**
@@ -337,7 +340,7 @@ public class POIFSFileSystem extends BlockStore
}
// don't allow huge allocations with invalid header-values
- IOUtils.safelyAllocateCheck(maxSize, MAX_ALLOCATION_SIZE);
+ ArrayUtil.strictAllocateCheck(maxSize, MAX_ALLOCATION_SIZE);
ByteBuffer data = ByteBuffer.allocate(Math.toIntExact(maxSize));
diff --git a/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java
b/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java
index 5726ccec52..a56a1cd161 100644
--- a/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java
+++ b/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java
@@ -73,7 +73,17 @@ public class VBAMacroReader implements Closeable {
private static final Logger LOGGER =
PoiLogManager.getLogger(VBAMacroReader.class);
//arbitrary limit on size of strings to read, etc.
- private static final int MAX_STRING_LENGTH = 20000;
+ private static final int DEFAULT_MAX_STRING_LENGTH = 20000;
+ private static int MAX_STRING_LENGTH = DEFAULT_MAX_STRING_LENGTH;
+
+ public static void setMaxStringLength(int maxStringLength) {
+ MAX_STRING_LENGTH = maxStringLength;
+ }
+
+ public static int getMaxStringLength() {
+ return MAX_STRING_LENGTH;
+ }
+
protected static final String VBA_PROJECT_OOXML = "vbaProject.bin";
protected static final String VBA_PROJECT_POIFS = "VBA";
@@ -714,7 +724,7 @@ public class VBAMacroReader implements Closeable {
* @throws IOException If reading from the stream fails
*/
private static String readString(InputStream stream, int length, Charset
charset) throws IOException {
- byte[] buffer = IOUtils.safelyAllocate(length, MAX_STRING_LENGTH);
+ byte[] buffer = IOUtils.safelyAllocate(length, MAX_STRING_LENGTH,
"VBAMacroReader.setMaxStringLength");
int bytesRead = IOUtils.readFully(stream, buffer);
if (bytesRead != length) {
throw new IOException("Tried to read: "+length +
@@ -779,7 +789,8 @@ public class VBAMacroReader implements Closeable {
}
private String readUnicodeString(RLEDecompressingInputStream in, int
unicodeNameRecordLength) throws IOException {
- byte[] buffer = IOUtils.safelyAllocate(unicodeNameRecordLength,
MAX_STRING_LENGTH);
+ byte[] buffer = IOUtils.safelyAllocate(unicodeNameRecordLength,
MAX_STRING_LENGTH,
+ "VBAMacroReader.getMaxRecordLength()");
int bytesRead = IOUtils.readFully(in, buffer);
if (bytesRead != unicodeNameRecordLength) {
throw new EOFException();
diff --git a/poi/src/main/java/org/apache/poi/poifs/property/PropertyTable.java
b/poi/src/main/java/org/apache/poi/poifs/property/PropertyTable.java
index 5af0725d17..bc50d7a00a 100644
--- a/poi/src/main/java/org/apache/poi/poifs/property/PropertyTable.java
+++ b/poi/src/main/java/org/apache/poi/poifs/property/PropertyTable.java
@@ -91,7 +91,8 @@ public final class PropertyTable implements BATManaged {
}
}
if (data == null) {
- data =
IOUtils.safelyAllocate(_bigBigBlockSize.getBigBlockSize(),
POIFSFileSystem.getMaxRecordLength());
+ data =
IOUtils.safelyAllocate(_bigBigBlockSize.getBigBlockSize(),
+ POIFSFileSystem.getMaxRecordLength(),
"POIFSFileSystem.getMaxRecordLength()");
int toRead = data.length;
if (bb.remaining() < _bigBigBlockSize.getBigBlockSize()) {
diff --git a/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlock.java
b/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlock.java
index 44645d7d89..c5d3fba283 100644
--- a/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlock.java
+++ b/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlock.java
@@ -111,7 +111,8 @@ public final class HeaderBlock implements
HeaderBlockConstants {
// Fetch the rest of the block if needed
if(bigBlockSize.getBigBlockSize() != 512) {
int rest = bigBlockSize.getBigBlockSize() - 512;
- byte[] tmp = IOUtils.safelyAllocate(rest,
POIFSFileSystem.getMaxRecordLength());
+ byte[] tmp = IOUtils.safelyAllocate(rest,
POIFSFileSystem.getMaxRecordLength(),
+ "POIFSFileSystem.setMaxRecordLength()");
IOUtils.readFully(stream, tmp);
}
}
diff --git
a/poi/src/main/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
b/poi/src/main/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
index aa895e7fee..1b9cc2934d 100644
--- a/poi/src/main/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
+++ b/poi/src/main/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
@@ -259,7 +259,8 @@ public class EmbeddedExtractor implements
Iterable<EmbeddedExtractor> {
}
int pictureBytesLen = idxEnd-idxStart+6;
- byte[] pdfBytes = IOUtils.safelyClone(pictureBytes, idxStart,
pictureBytesLen, MAX_RECORD_LENGTH);
+ byte[] pdfBytes = IOUtils.safelyClone(pictureBytes, idxStart,
pictureBytesLen,
+ MAX_RECORD_LENGTH,
"EmbeddedExtractor.setMaxRecordLength()");
String filename = source.getShapeName() == null ? "empty" :
source.getShapeName().trim();
if (!endsWithIgnoreCase(filename, ".pdf")) {
filename += ".pdf";
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/Formula.java
b/poi/src/main/java/org/apache/poi/ss/formula/Formula.java
index 0c4cc68859..7d366b243f 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/Formula.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/Formula.java
@@ -26,6 +26,7 @@ import org.apache.poi.ss.formula.ptg.ExpPtg;
import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.formula.ptg.TblPtg;
import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.util.ArrayUtil;
import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
@@ -79,7 +80,8 @@ public class Formula implements GenericRecord {
* @return A new formula object as read from the stream. Possibly empty,
never {@code null}.
*/
public static Formula read(int encodedTokenLen, LittleEndianInput in, int
totalEncodedLen) {
- byte[] byteEncoding = IOUtils.safelyAllocate(totalEncodedLen,
MAX_ENCODED_LEN);
+ ArrayUtil.strictAllocateCheck(totalEncodedLen, MAX_ENCODED_LEN);
+ byte[] byteEncoding = new byte[totalEncodedLen];
in.readFully(byteEncoding);
return new Formula(byteEncoding, encodedTokenLen);
}
diff --git
a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
index 4b6e6fa2e7..6d5ab828ee 100644
---
a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
+++
b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
@@ -155,7 +155,8 @@ final class FunctionMetadataReader {
// (all unspecified params are assumed to be the same as the last)
nItems --;
}
- byte[] result = IOUtils.safelyAllocate(nItems, getMaxRecordLength());
+ byte[] result = IOUtils.safelyAllocate(nItems, getMaxRecordLength(),
+ "FunctionMetadataReader.setMaxRecordLength()");
for (int i = 0; i < nItems; i++) {
result[i] = parseOperandTypeCode(array[i]);
}
diff --git a/poi/src/main/java/org/apache/poi/util/LZWDecompresser.java
b/poi/src/main/java/org/apache/poi/util/LZWDecompresser.java
index 3bbec57f50..97d3d0f5a2 100644
--- a/poi/src/main/java/org/apache/poi/util/LZWDecompresser.java
+++ b/poi/src/main/java/org/apache/poi/util/LZWDecompresser.java
@@ -144,7 +144,8 @@ public abstract class LZWDecompresser {
// These are bytes as looked up in the dictionary
// It needs to be signed, as it'll get passed on to
// the output stream
- final byte[] dataB = IOUtils.safelyAllocate(16L + codeLengthIncrease,
MAX_RECORD_LENGTH);
+ final byte[] dataB = IOUtils.safelyAllocate(16L + codeLengthIncrease,
+ MAX_RECORD_LENGTH, "LZWDecompresser.setMaxRecordLength()");
// This is an unsigned byte read from the stream
// It needs to be unsigned, so that bit stuff works
int dataI;
diff --git a/poi/src/main/java/org/apache/poi/util/StringUtil.java
b/poi/src/main/java/org/apache/poi/util/StringUtil.java
index c1bb521543..cf9524f0a4 100644
--- a/poi/src/main/java/org/apache/poi/util/StringUtil.java
+++ b/poi/src/main/java/org/apache/poi/util/StringUtil.java
@@ -163,7 +163,7 @@ public final class StringUtil {
* @return ISO_8859_1 encoded result
*/
public static String readCompressedUnicode(LittleEndianInput in, int
nChars) {
- byte[] buf = IOUtils.safelyAllocate(nChars, MAX_RECORD_LENGTH);
+ byte[] buf = IOUtils.safelyAllocate(nChars, MAX_RECORD_LENGTH,
"StringUtil.setMaxRecordLength()");
in.readFully(buf);
return new String(buf, ISO_8859_1);
}
@@ -301,7 +301,8 @@ public final class StringUtil {
}
public static String readUnicodeLE(LittleEndianInput in, int nChars) {
- byte[] bytes = IOUtils.safelyAllocate(nChars * 2L, MAX_RECORD_LENGTH);
+ byte[] bytes = IOUtils.safelyAllocate(nChars * 2L, MAX_RECORD_LENGTH,
+ "StringUtil.setMaxRecordLength()");
in.readFully(bytes);
return new String(bytes, UTF16LE);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]