Eclipse warnings, helper unit-test, improve information provided in Exceptions, do not swallow inner stacktraces, ...
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1724486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a08539ef02
commit
e91e15ab10
@ -114,7 +114,7 @@ public abstract class AbstractFileHandler implements FileHandler {
|
|||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
if(!EXPECTED_EXTRACTOR_FAILURES.contains(file)) {
|
if(!EXPECTED_EXTRACTOR_FAILURES.contains(file)) {
|
||||||
throw new Exception("While handling " + file, e);
|
throw e;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
extractor.close();
|
extractor.close();
|
||||||
|
@ -19,6 +19,7 @@ package org.apache.poi.stress;
|
|||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
@ -57,4 +58,10 @@ public class HSLFFileHandler extends SlideShowHandler {
|
|||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a test-case to test this locally without executing the full TestAllFiles
|
||||||
|
@Test
|
||||||
|
public void testExtractor() throws Exception {
|
||||||
|
handleExtracting(new File("test-data/slideshow/ae.ac.uaeu.faculty_nafaachbili_GeomLec1.pptx"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ public class CellFormat {
|
|||||||
if (DateUtil.isValidExcelDate(numericValue)) {
|
if (DateUtil.isValidExcelDate(numericValue)) {
|
||||||
return getApplicableFormatPart(numericValue).apply(value);
|
return getApplicableFormatPart(numericValue).apply(value);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("value not a valid Excel date");
|
throw new IllegalArgumentException("value " + numericValue + " of date " + value + " is not a valid Excel date");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return textFmt.apply(value);
|
return textFmt.apply(value);
|
||||||
|
@ -390,8 +390,7 @@ public final class PackagePropertiesPart extends PackagePart implements
|
|||||||
try {
|
try {
|
||||||
this.created = setDateValue(created);
|
this.created = setDateValue(created);
|
||||||
} catch (InvalidFormatException e) {
|
} catch (InvalidFormatException e) {
|
||||||
throw new IllegalArgumentException("created : "
|
throw new IllegalArgumentException("Date for created could not be parsed: " + created, e);
|
||||||
+ e.getLocalizedMessage(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +572,8 @@ public final class PackagePropertiesPart extends PackagePart implements
|
|||||||
d = df.parse(dateTzStr, new ParsePosition(0));
|
d = df.parse(dateTzStr, new ParsePosition(0));
|
||||||
}
|
}
|
||||||
if (d == null) {
|
if (d == null) {
|
||||||
throw new InvalidFormatException("Date not well formated");
|
throw new InvalidFormatException("Date " + dateTzStr + " not well formated, "
|
||||||
|
+ "expected format " + DEFAULT_DATEFORMAT + " or " + ALTERNATIVE_DATEFORMAT);
|
||||||
}
|
}
|
||||||
return new Nullable<Date>(d);
|
return new Nullable<Date>(d);
|
||||||
}
|
}
|
||||||
|
@ -2586,8 +2586,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
|||||||
wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
|
wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
|
||||||
|
|
||||||
CalculationChain chain = ((XSSFWorkbook)wb).getCalculationChain();
|
CalculationChain chain = ((XSSFWorkbook)wb).getCalculationChain();
|
||||||
CTCalcCell[] cArray = chain.getCTCalcChain().getCArray();
|
for(CTCalcCell calc : chain.getCTCalcChain().getCList()) {
|
||||||
for(CTCalcCell calc : cArray) {
|
|
||||||
// A2 to A6 should be gone
|
// A2 to A6 should be gone
|
||||||
assertFalse(calc.getR().equals("A2"));
|
assertFalse(calc.getR().equals("A2"));
|
||||||
assertFalse(calc.getR().equals("A3"));
|
assertFalse(calc.getR().equals("A3"));
|
||||||
@ -2601,8 +2600,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
|||||||
assertNotNull(sheetBack);
|
assertNotNull(sheetBack);
|
||||||
|
|
||||||
chain = ((XSSFWorkbook)wbBack).getCalculationChain();
|
chain = ((XSSFWorkbook)wbBack).getCalculationChain();
|
||||||
cArray = chain.getCTCalcChain().getCArray();
|
for(CTCalcCell calc : chain.getCTCalcChain().getCList()) {
|
||||||
for(CTCalcCell calc : cArray) {
|
|
||||||
// A2 to A6 should be gone
|
// A2 to A6 should be gone
|
||||||
assertFalse(calc.getR().equals("A2"));
|
assertFalse(calc.getR().equals("A2"));
|
||||||
assertFalse(calc.getR().equals("A3"));
|
assertFalse(calc.getR().equals("A3"));
|
||||||
|
Loading…
Reference in New Issue
Block a user