aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2017-06-09 12:47:03 +0000
committerDominik Stadler <centic@apache.org>2017-06-09 12:47:03 +0000
commit20ed0075e80fd3ed7534a768f3b0ec9f942497d6 (patch)
tree764535ad677023a9905ad9ca625abd0c73e33258 /src
parente9a9259a301fd54d49ec9dbc72bed44fb35ad200 (diff)
downloadpoi-20ed0075e80fd3ed7534a768f3b0ec9f942497d6.tar.gz
poi-20ed0075e80fd3ed7534a768f3b0ec9f942497d6.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/integrationtest/org/apache/poi/TestAllFiles.java5
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java20
2 files changed, 21 insertions, 4 deletions
diff --git a/src/integrationtest/org/apache/poi/TestAllFiles.java b/src/integrationtest/org/apache/poi/TestAllFiles.java
index 3dafca2915..f3d79eb172 100644
--- a/src/integrationtest/org/apache/poi/TestAllFiles.java
+++ b/src/integrationtest/org/apache/poi/TestAllFiles.java
@@ -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",
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java
index fc1011470f..af7c8c1673 100644
--- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java
+++ b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java
@@ -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();
+ }
}