diff options
Diffstat (limited to 'src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java')
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java b/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java index 480a7faf61..7f9c22ff41 100644 --- a/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java @@ -79,26 +79,26 @@ public abstract class AbstractFileHandler implements FileHandler { long modified = file.lastModified(); POITextExtractor extractor = null; - try { + try { extractor = ExtractorFactory.createExtractor(file); assertNotNull("Should get a POITextExtractor but had none for file " + file, extractor); assertNotNull("Should get some text but had none for file " + file, extractor.getText()); - + // also try metadata @SuppressWarnings("resource") POITextExtractor metadataExtractor = extractor.getMetadataTextExtractor(); assertNotNull(metadataExtractor.getText()); - assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!", + assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!", EXPECTED_EXTRACTOR_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName())); - + assertEquals("File should not be modified by extractor", length, file.length()); assertEquals("File should not be modified by extractor", modified, file.lastModified()); - + handleExtractingAsStream(file); - - if(extractor instanceof POIOLE2TextExtractor) { + + if (extractor instanceof POIOLE2TextExtractor) { try (HPSFPropertiesExtractor hpsfExtractor = new HPSFPropertiesExtractor((POIOLE2TextExtractor) extractor)) { assertNotNull(hpsfExtractor.getDocumentSummaryInformationText()); assertNotNull(hpsfExtractor.getSummaryInformationText()); @@ -115,6 +115,10 @@ public abstract class AbstractFileHandler implements FileHandler { String msg = "org.apache.poi.EncryptedDocumentException: Export Restrictions in place - please install JCE Unlimited Strength Jurisdiction Policy files"; assumeFalse(msg.equals(e.getMessage())); throw e; + } catch (IllegalStateException e) { + if (!e.getMessage().contains("POI Scratchpad jar missing") || !Boolean.getBoolean("scratchpad.ignore")) { + throw e; + } } finally { IOUtils.closeQuietly(extractor); } |