aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/extractor
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-03-28 22:49:45 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-03-28 22:49:45 +0000
commit1e65636048704a6410bff54ee245ec083585a366 (patch)
treebc0b606a70ce6ae3726a0a0903dcf6e6a89ff20b /src/ooxml/testcases/org/apache/poi/extractor
parent033580e1b3eae57b5ff6752c5c7d7f4c6cf1ac04 (diff)
downloadpoi-1e65636048704a6410bff54ee245ec083585a366.tar.gz
poi-1e65636048704a6410bff54ee245ec083585a366.zip
some zips can't be opened via ZipFile in JDK6, as the central directory
contains either non-latin entries or the compression type can't be handled the workaround is to iterate over the stream and not the directory git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1736933 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/extractor')
-rw-r--r--src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java b/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
index 0be9740b78..4a4a61e45e 100644
--- a/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
+++ b/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
@@ -32,6 +32,7 @@ import org.apache.poi.POIOLE2TextExtractor;
import org.apache.poi.POITextExtractor;
import org.apache.poi.POIXMLException;
import org.apache.poi.POIXMLTextExtractor;
+import org.apache.poi.UnsupportedFileFormatException;
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
import org.apache.poi.hslf.extractor.PowerPointExtractor;
@@ -643,10 +644,7 @@ public class TestExtractorFactory {
public void testPackage() throws Exception {
// Excel
POIXMLTextExtractor extractor = ExtractorFactory.createExtractor(OPCPackage.open(xlsx.toString(), PackageAccess.READ));
- assertTrue(
- extractor
- instanceof XSSFExcelExtractor
- );
+ assertTrue(extractor instanceof XSSFExcelExtractor);
extractor.close();
extractor = ExtractorFactory.createExtractor(OPCPackage.open(xlsx.toString()));
assertTrue(extractor.getText().length() > 200);
@@ -654,48 +652,33 @@ public class TestExtractorFactory {
// Word
extractor = ExtractorFactory.createExtractor(OPCPackage.open(docx.toString()));
- assertTrue(
- extractor
- instanceof XWPFWordExtractor
- );
+ assertTrue(extractor instanceof XWPFWordExtractor);
extractor.close();
extractor = ExtractorFactory.createExtractor(OPCPackage.open(docx.toString()));
- assertTrue(
- extractor.getText().length() > 120
- );
+ assertTrue(extractor.getText().length() > 120);
extractor.close();
// PowerPoint
extractor = ExtractorFactory.createExtractor(OPCPackage.open(pptx.toString()));
- assertTrue(
- extractor
- instanceof XSLFPowerPointExtractor
- );
+ assertTrue(extractor instanceof XSLFPowerPointExtractor);
extractor.close();
extractor = ExtractorFactory.createExtractor(OPCPackage.open(pptx.toString()));
- assertTrue(
- extractor.getText().length() > 120
- );
+ assertTrue(extractor.getText().length() > 120);
extractor.close();
// Visio
extractor = ExtractorFactory.createExtractor(OPCPackage.open(vsdx.toString()));
- assertTrue(
- extractor
- instanceof XDGFVisioExtractor
- );
- assertTrue(
- extractor.getText().length() > 20
- );
+ assertTrue(extractor instanceof XDGFVisioExtractor);
+ assertTrue(extractor.getText().length() > 20);
extractor.close();
// Text
try {
ExtractorFactory.createExtractor(OPCPackage.open(txt.toString()));
fail();
- } catch(InvalidOperationException e) {
+ } catch(UnsupportedFileFormatException e) {
// Good
}
}