mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08: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;
|
POITextExtractor extractor = null;
|
||||||
String fileAndParentName = file.getParentFile().getName() + "/" + file.getName();
|
String fileAndParentName = file.getParentFile().getName() + "/" + file.getName();
|
||||||
try {
|
try {
|
||||||
|
// fix windows absolute paths for exception message tracking
|
||||||
|
String relPath = file.getPath().replace(".*test-data", "test-data").replace('\\', '/');
|
||||||
extractor = ExtractorFactory.createExtractor(file);
|
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
|
// also try metadata
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
@ -99,7 +101,7 @@ public abstract class AbstractFileHandler implements FileHandler {
|
|||||||
assertNotNull(metadataExtractor.getText());
|
assertNotNull(metadataExtractor.getText());
|
||||||
|
|
||||||
assertFalse(EXPECTED_EXTRACTOR_FAILURES.contains(fileAndParentName),
|
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(length, file.length(), "File should not be modified by extractor");
|
||||||
assertEquals(modified, file.lastModified(), "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