Author: tilman
Date: Sat May  4 13:13:19 2024
New Revision: 1917498

URL: http://svn.apache.org/viewvc?rev=1917498&view=rev
Log:
PDFBOX-5811: catch exceptions from broken destinations early

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

Modified: 
pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java?rev=1917498&r1=1917497&r2=1917498&view=diff
==============================================================================
--- 
pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java
 (original)
+++ 
pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java
 Sat May  4 13:13:19 2024
@@ -140,20 +140,27 @@ public class PagePane implements ActionL
             rectMap.put(linkAnnotation.getRectangle(), "URI: " + 
uriAction.getURI());
             return;
         }
-        PDDestination destination;
-        if (action instanceof PDActionGoTo)
+        PDDestination destination = null;
+        try
         {
-            PDActionGoTo goToAction = (PDActionGoTo) action;
-            destination = goToAction.getDestination();
+            if (action instanceof PDActionGoTo)
+            {
+                PDActionGoTo goToAction = (PDActionGoTo) action;
+                destination = goToAction.getDestination();
+            }
+            else
+            {
+                destination = linkAnnotation.getDestination();
+            }
+            if (destination instanceof PDNamedDestination)
+            {
+                destination = document.getDocumentCatalog().
+                        findNamedDestinationPage((PDNamedDestination) 
destination);
+            }
         }
-        else
+        catch (IOException ex)
         {
-            destination = linkAnnotation.getDestination();
-        }
-        if (destination instanceof PDNamedDestination)
-        {
-            destination = document.getDocumentCatalog().
-                    findNamedDestinationPage((PDNamedDestination) destination);
+            LOG.error(ex.getMessage(), ex);
         }
         if (destination instanceof PDPageDestination)
         {


Reply via email to