]> source.dussan.org Git - poi.git/commitdiff
Fix bug 58760: non-standard namespace-key breaks parsing XLSX files
authorDominik Stadler <centic@apache.org>
Thu, 31 Dec 2015 09:56:33 +0000 (09:56 +0000)
committerDominik Stadler <centic@apache.org>
Thu, 31 Dec 2015 09:56:33 +0000 (09:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722433 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/TestAllFiles.java
src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index ecf30a677dbdbe80467b41e972692c9f6d254ebb..a23dbdd7cc28a79ea4c8122b8af577373eefe999 100644 (file)
@@ -259,9 +259,6 @@ public class TestAllFiles {
         // non-TNEF files
         EXPECTED_FAILURES.add("ddf/Container.dat");
         EXPECTED_FAILURES.add("ddf/47143.dat");
-        
-        // will be fixed as part of bug 58760
-        EXPECTED_FAILURES.add("spreadsheet/58760.xlsx");
     }
 
     private static final Set<String> IGNORED = new HashSet<String>();
index aed9bacb151b82b90a181bde46b9356ec873613c..4d01e1ca782354ef7e0b5ab154bb051a8156ba2b 100644 (file)
@@ -320,7 +320,7 @@ public final class PackageRelationshipCollection implements
             // Check OPC compliance M4.1 rule
             boolean fCorePropertiesRelationship = false;
 
-            NodeList nodeList = root.getElementsByTagName(PackageRelationship.RELATIONSHIP_TAG_NAME);
+            NodeList nodeList = root.getElementsByTagNameNS(PackageNamespaces.RELATIONSHIPS, PackageRelationship.RELATIONSHIP_TAG_NAME);
             int nodeCount = nodeList.getLength();
             for (int i = 0; i < nodeCount; i++) {
                 Element element = (Element)nodeList.item(i);
index eb569e3a8848426c50ce7cedbedf6f4e13e1bd7b..cc8550b9038f4271ca02f6f8a451f62acb34c2f3 100644 (file)
@@ -377,7 +377,7 @@ public abstract class ContentTypeManager {
                        Document xmlContentTypetDoc = DocumentHelper.readDocument(in);
 
                        // Default content types
-                       NodeList defaultTypes = xmlContentTypetDoc.getDocumentElement().getElementsByTagName(DEFAULT_TAG_NAME);
+                       NodeList defaultTypes = xmlContentTypetDoc.getDocumentElement().getElementsByTagNameNS(TYPES_NAMESPACE_URI, DEFAULT_TAG_NAME);
                        int defaultTypeCount = defaultTypes.getLength();
                        for (int i = 0; i < defaultTypeCount; i++) {
                 Element element = (Element) defaultTypes.item(i);
@@ -387,7 +387,7 @@ public abstract class ContentTypeManager {
                        }
 
                        // Overriden content types
-            NodeList overrideTypes = xmlContentTypetDoc.getDocumentElement().getElementsByTagName(OVERRIDE_TAG_NAME);
+            NodeList overrideTypes = xmlContentTypetDoc.getDocumentElement().getElementsByTagNameNS(TYPES_NAMESPACE_URI, OVERRIDE_TAG_NAME);
             int overrideTypeCount = overrideTypes.getLength();
             for (int i = 0; i < overrideTypeCount; i++) {
                                Element element = (Element) overrideTypes.item(i);
index 870a8c4e5d48e4b256bcf3e26db434c8f24d955f..78b29cb104981e2557b68e36642fb90e30924d62 100644 (file)
@@ -2879,7 +2879,6 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
      * ! Rule: Package require content types when retrieving a part from a package. [M.1.14]
      */
     @Test
-    @Ignore
     public void test58760() throws Exception {
         Workbook wb = XSSFTestDataSamples.openSampleWorkbook("58760.xlsx");
         assertEquals(1, wb.getNumberOfSheets());