Author: fanningpj
Date: Sun Oct 24 09:37:50 2021
New Revision: 1894526
URL: http://svn.apache.org/viewvc?rev=1894526&view=rev
Log:
configurable max record len
Modified:
poi/trunk/poi-excelant/src/main/java9/module-info.class
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SoundData.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfText.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFOldDocument.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/OldTextPieceTable.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/TextPieceTable.java
Modified: poi/trunk/poi-excelant/src/main/java9/module-info.class
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-excelant/src/main/java9/module-info.class?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
Binary files - no diff available.
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SoundData.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SoundData.java?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SoundData.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SoundData.java
Sun Oct 24 09:37:50 2021
@@ -34,7 +34,22 @@ public final class SoundData extends Rec
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 100_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 100_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for SoundData
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for SoundData
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
/**
* Record header.
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfText.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfText.java?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfText.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfText.java
Sun Oct 24 09:37:50 2021
@@ -49,7 +49,22 @@ import org.apache.poi.util.LocaleUtil;
public class HwmfText {
private static final Logger LOG = LogManager.getLogger(HwmfText.class);
- private static final int MAX_RECORD_LENGTH = 1_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 1_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for HwmfText
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HwmfText
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
/**
* The META_SETTEXTCHAREXTRA record defines inter-character spacing for
text justification in the
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java
Sun Oct 24 09:37:50 2021
@@ -67,7 +67,22 @@ public abstract class HWPFDocumentCore e
protected static final String STREAM_TABLE_1 = "1Table";
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 500_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 500_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for HWPFDocumentCore
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HWPFDocumentCore
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
/**
* Size of the not encrypted part of the FIB
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFOldDocument.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFOldDocument.java?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFOldDocument.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFOldDocument.java
Sun Oct 24 09:37:50 2021
@@ -46,15 +46,29 @@ import org.apache.poi.util.NotImplemente
import org.apache.poi.util.StringUtil;
/**
- * Provides very simple support for old (Word 6 / Word 95)
- * files.
+ * Provides very simple support for old (Word 6 / Word 95) files.
*/
public class HWPFOldDocument extends HWPFDocumentCore {
private static final Logger LOG =
LogManager.getLogger(HWPFOldDocument.class);
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 10_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 10_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for HWPFOldDocument
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HWPFOldDocument
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
private static final Charset DEFAULT_CHARSET = StringUtil.WIN_1252;
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/OldTextPieceTable.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/OldTextPieceTable.java?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/OldTextPieceTable.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/OldTextPieceTable.java
Sun Oct 24 09:37:50 2021
@@ -26,8 +26,6 @@ import org.apache.poi.util.Internal;
@Internal
public class OldTextPieceTable extends TextPieceTable {
- //arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 100_000_000;
public OldTextPieceTable() {
super();
@@ -82,7 +80,7 @@ public class OldTextPieceTable extends T
int textSizeBytes = textSizeChars * multiple;
// Grab the data that makes up the piece
- byte[] buf = IOUtils.safelyClone(documentStream, start,
textSizeBytes, MAX_RECORD_LENGTH);
+ byte[] buf = IOUtils.safelyClone(documentStream, start,
textSizeBytes, getMaxRecordLength());
// And now build the piece
final TextPiece newTextPiece = newTextPiece(nodeStartChars,
nodeEndChars, buf, pieces[x]);
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/TextPieceTable.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/TextPieceTable.java?rev=1894526&r1=1894525&r2=1894526&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/TextPieceTable.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/TextPieceTable.java
Sun Oct 24 09:37:50 2021
@@ -36,13 +36,28 @@ import static org.apache.logging.log4j.u
/**
* The piece table for matching up character positions to bits of text. This
* mostly works in bytes, but the TextPieces themselves work in characters.
This
- * does the icky convertion.
+ * does the icky conversion.
*/
@Internal
public class TextPieceTable implements CharIndexTranslator {
private static final Logger LOG =
LogManager.getLogger(TextPieceTable.class);
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 100_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 100_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for TextPieceTable
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for TextPieceTable
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
// int _multiple;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]