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 2015/04/01 18:36:21 UTC

svn commit: r1670722 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java

Author: tilman
Date: Wed Apr  1 16:36:21 2015
New Revision: 1670722

URL: http://svn.apache.org/r1670722
Log:
PDFBOX-2739: throw exception if document closed

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java?rev=1670722&r1=1670721&r2=1670722&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java Wed Apr  1 16:36:21 2015
@@ -223,6 +223,14 @@ public class PDFMergerUtility
      */
     public void appendDocument(PDDocument destination, PDDocument source) throws IOException
     {
+        if (source.getDocument().isClosed())
+        {
+            throw new IOException("Error: source PDF is closed.");
+        }
+        if (destination.getDocument().isClosed())
+        {
+            throw new IOException("Error: destination PDF is closed.");
+        }
         if (destination.isEncrypted())
         {
             throw new IOException("Error: destination PDF is encrypted, can't append encrypted PDF documents.");