]> source.dussan.org Git - poi.git/commitdiff
Remove catches which were previously incorrectly declared when not needed
authorNick Burch <nick@apache.org>
Thu, 13 Aug 2015 20:31:25 +0000 (20:31 +0000)
committerNick Burch <nick@apache.org>
Thu, 13 Aug 2015 20:31:25 +0000 (20:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1695775 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java

index ec701b7e32c533b415035d07ef7deb83cfd63554..3b7fb443bb4bdaec3af4998efc8a4c64d66379f2 100644 (file)
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.POIXMLDocument;
-import org.apache.poi.POIXMLException;
 import org.apache.poi.POIXMLTextExtractor;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
@@ -117,51 +116,44 @@ public class XWPFWordExtractor extends POIXMLTextExtractor {
     }
 
     public void appendParagraphText(StringBuffer text, XWPFParagraph paragraph) {
-        try {
-            CTSectPr ctSectPr = null;
-            if (paragraph.getCTP().getPPr() != null) {
-                ctSectPr = paragraph.getCTP().getPPr().getSectPr();
-            }
-
-            XWPFHeaderFooterPolicy headerFooterPolicy = null;
+        CTSectPr ctSectPr = null;
+        if (paragraph.getCTP().getPPr() != null) {
+            ctSectPr = paragraph.getCTP().getPPr().getSectPr();
+        }
 
-            if (ctSectPr != null) {
-                headerFooterPolicy = new XWPFHeaderFooterPolicy(document, ctSectPr);
-                extractHeaders(text, headerFooterPolicy);
-            }
+        XWPFHeaderFooterPolicy headerFooterPolicy = null;
 
+        if (ctSectPr != null) {
+            headerFooterPolicy = new XWPFHeaderFooterPolicy(document, ctSectPr);
+            extractHeaders(text, headerFooterPolicy);
+        }
 
-            for (IRunElement run : paragraph.getRuns()) {
-                text.append(run.toString());
-                if (run instanceof XWPFHyperlinkRun && fetchHyperlinks) {
-                    XWPFHyperlink link = ((XWPFHyperlinkRun) run).getHyperlink(document);
-                    if (link != null)
-                        text.append(" <" + link.getURL() + ">");
-                }
-            }
 
-            // Add comments
-            XWPFCommentsDecorator decorator = new XWPFCommentsDecorator(paragraph, null);
-            String commentText = decorator.getCommentText();
-            if (commentText.length() > 0) {
-                text.append(commentText).append('\n');
+        for (IRunElement run : paragraph.getRuns()) {
+            text.append(run.toString());
+            if (run instanceof XWPFHyperlinkRun && fetchHyperlinks) {
+                XWPFHyperlink link = ((XWPFHyperlinkRun) run).getHyperlink(document);
+                if (link != null)
+                    text.append(" <" + link.getURL() + ">");
             }
+        }
 
-            // Do endnotes and footnotes
-            String footnameText = paragraph.getFootnoteText();
-            if (footnameText != null && footnameText.length() > 0) {
-                text.append(footnameText + '\n');
-            }
+        // Add comments
+        XWPFCommentsDecorator decorator = new XWPFCommentsDecorator(paragraph, null);
+        String commentText = decorator.getCommentText();
+        if (commentText.length() > 0) {
+            text.append(commentText).append('\n');
+        }
 
-            if (ctSectPr != null) {
-                extractFooters(text, headerFooterPolicy);
-            }
-        } catch (IOException e) {
-            throw new POIXMLException(e);
-        } catch (XmlException e) {
-            throw new POIXMLException(e);
+        // Do endnotes and footnotes
+        String footnameText = paragraph.getFootnoteText();
+        if (footnameText != null && footnameText.length() > 0) {
+            text.append(footnameText + '\n');
         }
 
+        if (ctSectPr != null) {
+            extractFooters(text, headerFooterPolicy);
+        }
     }
 
     private void appendTableText(StringBuffer text, XWPFTable table) {