You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/06/20 16:32:02 UTC

svn commit: r1861700 - /pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java

Author: tilman
Date: Thu Jun 20 16:32:02 2019
New Revision: 1861700

URL: http://svn.apache.org/viewvc?rev=1861700&view=rev
Log:
PDFBOX-2941: SonarQube fix

Modified:
    pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java

Modified: pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java?rev=1861700&r1=1861699&r2=1861700&view=diff
==============================================================================
--- pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java (original)
+++ pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java Thu Jun 20 16:32:02 2019
@@ -39,6 +39,8 @@ import javax.swing.JPanel;
 import javax.swing.SwingWorker;
 import javax.swing.event.AncestorEvent;
 import javax.swing.event.AncestorListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.debugger.ui.ImageUtil;
 import org.apache.pdfbox.debugger.ui.RotationMenu;
@@ -69,6 +71,7 @@ import org.apache.pdfbox.pdmodel.interac
  */
 public class PagePane implements ActionListener, AncestorListener, MouseMotionListener, MouseListener
 {
+    private static final Log LOG = LogFactory.getLog(PagePane.class);
     private JPanel panel;
     private int pageIndex = -1;
     private final PDDocument document;
@@ -97,11 +100,11 @@ public class PagePane implements ActionL
         try
         {
             collectFieldLocations();
-            collectLinkLocations();            
+            collectLinkLocations();
         }
         catch (IOException ex)
         {
-            // ignore
+            LOG.info(ex.getMessage(), ex);
         }
     }
 
@@ -147,7 +150,7 @@ public class PagePane implements ActionL
         }
     }
 
-    private void collectFieldLocations()
+    private void collectFieldLocations() throws IOException
     {
         PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
         if (acroForm == null)
@@ -155,16 +158,9 @@ public class PagePane implements ActionL
             return;
         }
         Set<COSDictionary> dictionarySet = new HashSet<COSDictionary>();
-        try
-        {
-            for (PDAnnotation annotation : page.getAnnotations())
-            {
-                dictionarySet.add(annotation.getCOSObject());
-            }
-        }
-        catch (IOException ex)
+        for (PDAnnotation annotation : page.getAnnotations())
         {
-            return;
+            dictionarySet.add(annotation.getCOSObject());
         }
         for (PDField field : acroForm.getFieldTree())
         {