From cee9eb7e2b487c4b451bd167e07e6309835a943b Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 8 Mar 2021 23:14:11 +0000 Subject: try to fix windows path issues in exception messages git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887346 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/stress/AbstractFileHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java b/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java index 2497eb43cf..72f99c3f05 100644 --- a/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java @@ -88,10 +88,12 @@ public abstract class AbstractFileHandler implements FileHandler { POITextExtractor extractor = null; String fileAndParentName = file.getParentFile().getName() + "/" + file.getName(); try { + // fix windows absolute paths for exception message tracking + String relPath = file.getPath().replace(".*test-data", "test-data").replace('\\', '/'); extractor = ExtractorFactory.createExtractor(file); - assertNotNull(extractor, "Should get a POITextExtractor but had none for file " + file); + assertNotNull(extractor, "Should get a POITextExtractor but had none for file " + relPath); - assertNotNull(extractor.getText(), "Should get some text but had none for file " + file); + assertNotNull(extractor.getText(), "Should get some text but had none for file " + relPath); // also try metadata @SuppressWarnings("resource") @@ -99,7 +101,7 @@ public abstract class AbstractFileHandler implements FileHandler { assertNotNull(metadataExtractor.getText()); assertFalse(EXPECTED_EXTRACTOR_FAILURES.contains(fileAndParentName), - "Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!"); + "Expected Extraction to fail for file " + relPath + " and handler " + this + ", but did not fail!"); assertEquals(length, file.length(), "File should not be modified by extractor"); assertEquals(modified, file.lastModified(), "File should not be modified by extractor"); -- cgit v1.2.3