]> source.dussan.org Git - poi.git/commitdiff
Eclipse warnings, helper unit-test, improve information provided in Exceptions, do...
authorDominik Stadler <centic@apache.org>
Wed, 13 Jan 2016 19:45:05 +0000 (19:45 +0000)
committerDominik Stadler <centic@apache.org>
Wed, 13 Jan 2016 19:45:05 +0000 (19:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1724486 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java
src/integrationtest/org/apache/poi/stress/HSLFFileHandler.java
src/java/org/apache/poi/ss/format/CellFormat.java
src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index 3bb0a53d5cc51763a87680fe8026c6b82fc9a08b..92eb1a82d5d388c48a6360ead16707102fff296a 100644 (file)
@@ -114,7 +114,7 @@ public abstract class AbstractFileHandler implements FileHandler {
             }\r
         } catch (IllegalArgumentException e) {\r
             if(!EXPECTED_EXTRACTOR_FAILURES.contains(file)) {\r
-                throw new Exception("While handling " + file, e);\r
+                throw e;\r
             }\r
         } finally {\r
             extractor.close();\r
index 822bf13735288da9dd8419f65df1b1eb628a746b..c0454e0d30517318d468d74053cc05b87929f495 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.stress;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 
@@ -57,4 +58,10 @@ public class HSLFFileHandler extends SlideShowHandler {
                        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"));
+   }
 }
index 40cca8c3c6b09ba0482f50ea0382fe65c003f902..d3a7f8df43d1299be8911e63ffcba3c119255c1b 100644 (file)
@@ -235,7 +235,7 @@ public class CellFormat {
             if (DateUtil.isValidExcelDate(numericValue)) {
                 return getApplicableFormatPart(numericValue).apply(value);
             } 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 {
             return textFmt.apply(value);
index 1d957e5a59414c01eeee014a627f32ca6b54dbd4..1b3690f72012bb86cb03878926cbdaef22c786aa 100644 (file)
@@ -48,7 +48,7 @@ public final class PackagePropertiesPart extends PackagePart implements
 
        public final static String NAMESPACE_DCTERMS_URI = "http://purl.org/dc/terms/";
 
-       private final static String DEFAULT_DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+       private final static String DEFAULT_DATEFORMAT =     "yyyy-MM-dd'T'HH:mm:ss'Z'";
        private final static String ALTERNATIVE_DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss.SS'Z'";
        
        
@@ -390,8 +390,7 @@ public final class PackagePropertiesPart extends PackagePart implements
                try {
                        this.created = setDateValue(created);
                } catch (InvalidFormatException e) {
-                       throw new IllegalArgumentException("created  : "
-                                       + e.getLocalizedMessage(), e);
+                       throw new IllegalArgumentException("Date for created could not be parsed: " + created, e);
                }
        }
 
@@ -573,7 +572,8 @@ public final class PackagePropertiesPart extends PackagePart implements
                    d = df.parse(dateTzStr, new ParsePosition(0));
                }
                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);
        }
index 17e1fa133e83bdde9763fe74c83b812d52d9a508..2fd86cff56990330763c583165750aac16574d0f 100644 (file)
@@ -2586,8 +2586,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
         wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
 
         CalculationChain chain = ((XSSFWorkbook)wb).getCalculationChain();
-        CTCalcCell[] cArray = chain.getCTCalcChain().getCArray();
-        for(CTCalcCell calc : cArray) {
+        for(CTCalcCell calc : chain.getCTCalcChain().getCList()) {
             // A2 to A6 should be gone
             assertFalse(calc.getR().equals("A2"));
             assertFalse(calc.getR().equals("A3"));
@@ -2601,8 +2600,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
         assertNotNull(sheetBack);
 
         chain = ((XSSFWorkbook)wbBack).getCalculationChain();
-        cArray = chain.getCTCalcChain().getCArray();
-        for(CTCalcCell calc : cArray) {
+        for(CTCalcCell calc : chain.getCTCalcChain().getCList()) {
             // A2 to A6 should be gone
             assertFalse(calc.getR().equals("A2"));
             assertFalse(calc.getR().equals("A3"));