Author: tilman
Date: Mon Apr 13 18:34:38 2026
New Revision: 1933031

Log:
PDFBOX-2941: remove URISyntaxException where possible

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

Modified: 
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
==============================================================================
--- 
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
      Mon Apr 13 18:34:35 2026        (r1933030)
+++ 
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
      Mon Apr 13 18:34:38 2026        (r1933031)
@@ -725,7 +725,7 @@ public class PDFDebugger extends JFrame
         {
             readPDFFile(filename, "");
         }
-        catch (IOException | URISyntaxException e)
+        catch (IOException e)
         {
             new ErrorDialog(e).setVisible(true);
         }
@@ -792,7 +792,7 @@ public class PDFDebugger extends JFrame
                 }
             }
         }
-        catch (IOException | URISyntaxException e)
+        catch (IOException e)
         {
             new ErrorDialog(e).setVisible(true);
         }
@@ -1371,13 +1371,13 @@ public class PDFDebugger extends JFrame
         }
     }
 
-    private void readPDFFile(String filePath, String password) throws 
IOException, URISyntaxException
+    private void readPDFFile(String filePath, String password) throws 
IOException
     {
         File file = new File(filePath);
         readPDFFile(file, password);
     }
     
-    private void readPDFFile(final File file, String password) throws 
IOException, URISyntaxException
+    private void readPDFFile(final File file, String password) throws 
IOException
     {
         if( document != null )
         {
@@ -1438,15 +1438,16 @@ public class PDFDebugger extends JFrame
         currentFilePath = urlString;
         LogDialog.instance().clear();
         TextDialog.instance().setVisible(false);
+        URL url = new URI(urlString).toURL();
 
         DocumentOpener documentOpener = new DocumentOpener(password)
         {
             @Override
-            PDDocument open() throws IOException, URISyntaxException
+            PDDocument open() throws IOException
             {
                 long t0 = System.nanoTime();
                 PDDocument doc = Loader.loadPDF(RandomAccessReadBuffer
-                        .createBufferFromStream(new 
URI(urlString).toURL().openStream()), password);
+                        .createBufferFromStream(url.openStream()), password);
                 long t1 = System.nanoTime();
                 long ms = TimeUnit.MILLISECONDS.convert(t1 - t0, 
TimeUnit.NANOSECONDS);
                 LOG.info("Parsed in " + ms + " ms");
@@ -1523,9 +1524,8 @@ public class PDFDebugger extends JFrame
          * 
          * @return the PDDocument instance
          * @throws IOException Cannot read document
-         * @throws URISyntaxException
          */
-        abstract PDDocument open() throws IOException, URISyntaxException;
+        abstract PDDocument open() throws IOException;
 
         /**
          * Call this!
@@ -1533,7 +1533,7 @@ public class PDFDebugger extends JFrame
          * @return the PDDocument instance
          * @throws IOException Cannot read document
          */
-        final PDDocument parse() throws IOException, URISyntaxException 
+        final PDDocument parse() throws IOException 
         {
             while (true)
             {

Reply via email to