From 7117fe26ade85b400456e98da57ef95146a204e9 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 18 Jun 2013 23:39:31 +0000 Subject: [PATCH] Fix the footnote doubling, and then enable the rest of the SDT tests from Tim Allison from bug #54849 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1494379 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/xwpf/usermodel/XWPFDocument.java | 5 ----- .../org/apache/poi/xwpf/usermodel/TestXWPFSDT.java | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java index e5371b980..406c670c0 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java @@ -237,11 +237,6 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { if (relation.equals(XWPFRelation.FOOTNOTE.getRelation())) { this.footnotes = (XWPFFootnotes)p; this.footnotes.onDocumentRead(); - // Warning - this apparently doubles footnotes - see bug #???? - FootnotesDocument footnotesDocument = FootnotesDocument.Factory.parse(p.getPackagePart().getInputStream()); - for(CTFtnEdn ctFtnEdn : footnotesDocument.getFootnotes().getFootnoteList()) { - footnotes.addFootnote(ctFtnEdn); - } } else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())){ EndnotesDocument endnotesDocument = EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream()); diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java index 5a25e9e2c..2359beac2 100644 --- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java +++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java @@ -43,8 +43,7 @@ public final class TestXWPFSDT extends TestCase { break; } } - // TODO Fix footnotes issues then enable -// assertEquals("controls size", 12, sdts.size()); + assertEquals("controls size", 12, sdts.size()); assertEquals("tag", "MyTag", tag); assertEquals("title", "MyTitle", title); @@ -70,8 +69,6 @@ public final class TestXWPFSDT extends TestCase { XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54849.docx"); List sdts = extractAllSDTs(doc); - // TODO Fix footnotes issue -/* assertEquals("number of sdts", contents.length, sdts.size()); for (int i = 0; i < sdts.size(); i++){//contents.length; i++){ @@ -79,7 +76,6 @@ public final class TestXWPFSDT extends TestCase { assertEquals(i+ ": " + contents[i], contents[i], sdt.getContent().toString()); } -*/ } public void testFailureToGetSDTAsCell() throws Exception{