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 2021/09/07 18:22:58 UTC

svn commit: r1893069 - /pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java

Author: tilman
Date: Tue Sep  7 18:22:57 2021
New Revision: 1893069

URL: http://svn.apache.org/viewvc?rev=1893069&view=rev
Log:
PDFBOX-4892: avoid throwing RuntimeException

Modified:
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java

Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1893069&r1=1893068&r2=1893069&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java Tue Sep  7 18:22:57 2021
@@ -423,7 +423,8 @@ public class PDFDebugger extends JFrame
                 }
                 catch (UnsupportedFlavorException e)
                 {
-                    throw new RuntimeException(e);
+                    new ErrorDialog(e).setVisible(true);
+                    return false;
                 }
                 return true;
             }
@@ -514,15 +515,7 @@ public class PDFDebugger extends JFrame
         reopenMenuItem.setEnabled(false);
         fileMenu.add(reopenMenuItem);
 
-        try
-        {
-            recentFiles = new RecentFiles(this.getClass(), 5);
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e);
-        }
-
+        recentFiles = new RecentFiles(this.getClass(), 5);
         recentFilesMenu = new JMenu("Open Recent");
         recentFilesMenu.setEnabled(false);
         addRecentFileItems();
@@ -660,7 +653,7 @@ public class PDFDebugger extends JFrame
         }
         catch (IOException e)
         {
-            throw new RuntimeException(e);
+            new ErrorDialog(e).setVisible(true);
         }
     }
 
@@ -701,7 +694,7 @@ public class PDFDebugger extends JFrame
         }
         catch (IOException e)
         {
-            throw new RuntimeException(e);
+            new ErrorDialog(e).setVisible(true);
         }
     }
 
@@ -1139,7 +1132,8 @@ public class PDFDebugger extends JFrame
             }
             catch( IOException e )
             {
-                throw new RuntimeException(e);
+                // no dialogbox, don't interfere with exit wish
+                e.printStackTrace();
             }
         }
         windowPrefs.setExtendedState(getExtendedState());
@@ -1209,7 +1203,7 @@ public class PDFDebugger extends JFrame
         }
         catch (PrinterException e)
         {
-            throw new RuntimeException(e);
+            new ErrorDialog(e).setVisible(true);
         }
     }