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 2014/09/01 18:59:51 UTC

svn commit: r1621843 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java

Author: tilman
Date: Mon Sep  1 16:59:50 2014
New Revision: 1621843

URL: http://svn.apache.org/r1621843
Log:
PDFBOX-2225: don't throw / rethrow RuntimeException

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java?rev=1621843&r1=1621842&r2=1621843&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java Mon Sep  1 16:59:50 2014
@@ -18,6 +18,7 @@ package org.apache.pdfbox.util;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -120,34 +121,24 @@ public class PDFMergerUtility
      * Add a source file to the list of files to merge.
      *
      * @param source Full path and file name of source document.
+     * 
+     * @throws FileNotFoundException If the file doesn't exist
      */
-    public void addSource(String source)
+    public void addSource(String source) throws FileNotFoundException
     {
-        try
-        {
-            sources.add(new FileInputStream(new File(source)));
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e);
-        }
+        sources.add(new FileInputStream(new File(source)));
     }
 
     /**
      * Add a source file to the list of files to merge.
      *
      * @param source File representing source document
+     * 
+     * @throws FileNotFoundException If the file doesn't exist
      */
-    public void addSource(File source)
+    public void addSource(File source) throws FileNotFoundException
     {
-        try
-        {
-            sources.add(new FileInputStream(source));
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e);
-        }
+        sources.add(new FileInputStream(source));
     }
 
     /**
@@ -314,10 +305,6 @@ public class PDFMergerUtility
                 throw new IOException(e);
             }
         }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e);
-        }
 
         COSArray destThreads = (COSArray) destCatalog.getCOSDictionary().getDictionaryObject(COSName.THREADS);
         COSArray srcThreads = (COSArray) cloner.cloneForNewDocument(destCatalog.getCOSDictionary().getDictionaryObject(