]> source.dussan.org Git - poi.git/commitdiff
Fix bug #51950 - XWPF may not always have footnotes in a document
authorNick Burch <nick@apache.org>
Wed, 5 Oct 2011 21:26:49 +0000 (21:26 +0000)
committerNick Burch <nick@apache.org>
Wed, 5 Oct 2011 21:26:49 +0000 (21:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1179449 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java

index cb49fb56ab28fcd4d535fa57a625709cda35d138..b391783ff2cefcbe133bac42f380e0aa485b6233 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta5" date="2011-??-??">
+           <action dev="poi-developers" type="fix">51950 - XWPF fix for footnotes not always being present in a document</action>
            <action dev="poi-developers" type="fix">51963 - Correct AreaReference handling of references containing a sheet name which includes a comma</action>
            <action dev="poi-developers" type="fix">51955 - XSSFReader supplied StylesTables need to have the theme data available</action>
            <action dev="poi-developers" type="fix">51716 - Removed incorrect assert in SXSSFSheet#getSXSSFSheet</action>
index 231103ed55fe811941a818770464620afccefcdc..c7d37d1bc5e204735601acf9ba714113188008eb 100644 (file)
@@ -351,15 +351,20 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
     }
 
     public XWPFFootnote getFootnoteByID(int id) {
-        return footnotes.getFootnoteById(id);
+       if(footnotes == null) return null;
+       return footnotes.getFootnoteById(id);
     }
 
     public XWPFFootnote getEndnoteByID(int id) {
-        return endnotes.get(id);
+       if(endnotes == null) return null;
+       return endnotes.get(id);
     }
 
     public List<XWPFFootnote> getFootnotes() {
-               return footnotes.getFootnotesList();
+       if(footnotes == null) {
+          return Collections.emptyList();
+       }
+       return footnotes.getFootnotesList();
     }
 
     public XWPFHyperlink[] getHyperlinks() {