git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894526 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_2_0
@@ -34,7 +34,22 @@ public final class SoundData extends RecordAtom { | |||
//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. |
@@ -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 |
@@ -67,7 +67,22 @@ public abstract class HWPFDocumentCore extends POIDocument { | |||
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 |
@@ -46,15 +46,29 @@ import org.apache.poi.util.NotImplemented; | |||
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; | |||
@@ -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 TextPieceTable { | |||
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]); |
@@ -36,13 +36,28 @@ import static org.apache.logging.log4j.util.Unbox.box; | |||
/** | |||
* 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; |