hwpt: add more 2 bytes to OldSectionTable to solve ArrayIndexOutOfBoundsException
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1001712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6de019f6e0
commit
286b682cdc
@ -60,8 +60,8 @@ public final class OldSectionTable extends SectionTable
|
|||||||
// section properties, and we're trying to decode them as if they
|
// section properties, and we're trying to decode them as if they
|
||||||
// were the new ones, we sometimes "need" more data than we have.
|
// were the new ones, we sometimes "need" more data than we have.
|
||||||
// As a workaround, have a few extra 0 bytes on the end!
|
// As a workaround, have a few extra 0 bytes on the end!
|
||||||
byte[] buf = new byte[sepxSize+2];
|
byte[] buf = new byte[sepxSize+4];
|
||||||
fileOffset += LittleEndian.SHORT_SIZE;
|
fileOffset += 4;
|
||||||
System.arraycopy(documentStream, fileOffset, buf, 0, buf.length);
|
System.arraycopy(documentStream, fileOffset, buf, 0, buf.length);
|
||||||
_sections.add(new SEPX(sed, startAt, endAt, charConv, buf));
|
_sections.add(new SEPX(sed, startAt, endAt, charConv, buf));
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,17 @@ public final class TestWordExtractor extends TestCase {
|
|||||||
assertEquals("\r\n", tp[5]);
|
assertEquals("\r\n", tp[5]);
|
||||||
assertEquals("Last (4th) paragraph.\r\n", tp[6]);
|
assertEquals("Last (4th) paragraph.\r\n", tp[6]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testWord95err() throws Exception {
|
||||||
|
// Can work with the special one
|
||||||
|
Word6Extractor w6e = new Word6Extractor(
|
||||||
|
POIDataSamples.getDocumentInstance().openResourceAsStream("word95err.doc")
|
||||||
|
);
|
||||||
|
String text = w6e.getText();
|
||||||
|
|
||||||
|
assertTrue(text.contains("subject"));
|
||||||
|
}
|
||||||
|
|
||||||
public void testWord6() throws Exception {
|
public void testWord6() throws Exception {
|
||||||
// Too old for the default
|
// Too old for the default
|
||||||
try {
|
try {
|
||||||
|
BIN
test-data/document/word95err.doc
Normal file
BIN
test-data/document/word95err.doc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user