mirror of
https://github.com/apache/poi.git
synced 2025-03-09 03:02:47 +00:00
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
This commit is contained in:
parent
afbef57d35
commit
cee9eb7e2b
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user