Author: kiwiwings
Date: Mon Mar  8 23:14:11 2021
New Revision: 1887346

URL: http://svn.apache.org/viewvc?rev=1887346&view=rev
Log:
try to fix windows path issues in exception messages

Modified:
    poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java

Modified: 
poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java?rev=1887346&r1=1887345&r2=1887346&view=diff
==============================================================================
--- 
poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java 
(original)
+++ 
poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java 
Mon Mar  8 23:14:11 2021
@@ -88,10 +88,12 @@ public abstract class AbstractFileHandle
         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 AbstractFileHandle
             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");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to