aboutsummaryrefslogtreecommitdiffstats
path: root/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java
diff options
context:
space:
mode:
Diffstat (limited to 'poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java')
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java
index 6571c650af..e103c3367b 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java
@@ -83,7 +83,8 @@ public final class HWPFDocument extends HWPFDocumentCore {
/*package*/ static final String PROPERTY_PRESERVE_BIN_TABLES = "org.apache.poi.hwpf.preserveBinTables";
private static final String PROPERTY_PRESERVE_TEXT_TABLE = "org.apache.poi.hwpf.preserveTextTable";
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 1_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 100_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
private static final String STREAM_DATA = "Data";
@@ -194,6 +195,20 @@ public final class HWPFDocument extends HWPFDocumentCore {
private Fields _fields;
/**
+ * @param length the max record length allowed for HWPFDocument
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HWPFDocument
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
+
+ /**
* This constructor loads a Word document from an InputStream.
*
* @param istream The InputStream that contains the Word document.