Browse Source

Bug 60374: Add test for ArrayIndexOutOfBounds on old Word Documents due to Non-Unicode

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1798200 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_17_BETA1
Dominik Stadler 7 years ago
parent
commit
20ed0075e8

+ 3
- 2
src/integrationtest/org/apache/poi/TestAllFiles.java View File

@@ -230,10 +230,10 @@ public class TestAllFiles {
FILE_PASSWORD = Collections.unmodifiableMap(passmap);
}

private static final Set<String> unmodifiableHashSet(String... a) {
private static Set<String> unmodifiableHashSet(String... a) {
return Collections.unmodifiableSet(hashSet(a));
}
private static final Set<String> hashSet(String... a) {
private static Set<String> hashSet(String... a) {
return new HashSet<String>(Arrays.asList(a));
}

@@ -249,6 +249,7 @@ public class TestAllFiles {
"document/Bug60936.doc",
"document/Bug60942.doc",
"document/Bug60942b.doc",
"document/cn.orthodox.www_divenbog_APRIL_30-APRIL.DOC",
"hpsf/TestMickey.doc",
"document/52117.doc",
"hpsf/TestInvertedClassID.doc",

+ 18
- 2
src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java View File

@@ -17,11 +17,16 @@

package org.apache.poi.hwpf.extractor;

import org.apache.poi.POIDataSamples;
import org.apache.poi.POITextExtractor;
import org.apache.poi.extractor.OLE2ExtractorFactory;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.POIDataSamples;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;

/**
* Tests for bugs with the WordExtractor
@@ -52,4 +57,15 @@ public final class TestWordExtractorBugs {
extractor.getText();
extractor.close();
}

@Test
public void testBug60374() throws Exception {
NPOIFSFileSystem fs = new NPOIFSFileSystem(SAMPLES.openResourceAsStream("cn.orthodox.www_divenbog_APRIL_30-APRIL.DOC"));
final POITextExtractor extractor = OLE2ExtractorFactory.createExtractor(fs);

// Check it gives text without error
assertNotNull(extractor.getText());

extractor.close();
}
}

BIN
test-data/document/cn.orthodox.www_divenbog_APRIL_30-APRIL.DOC View File


Loading…
Cancel
Save