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 2022/10/08 12:34:02 UTC

svn commit: r1904454 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java

Author: tilman
Date: Sat Oct  8 12:34:01 2022
New Revision: 1904454

URL: http://svn.apache.org/viewvc?rev=1904454&view=rev
Log:
PDFBOX-5523: check for input, improve javadoc

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java?rev=1904454&r1=1904453&r2=1904454&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java Sat Oct  8 12:34:01 2022
@@ -101,7 +101,7 @@ public class Overlay implements Closeabl
     /**
      * This will add overlays to a document.
      *
-     * @param specificPageOverlayFile Optional map of overlay files of which the first page will be
+     * @param specificPageOverlayMap Optional map of overlay files of which the first page will be
      * used for specific pages of the input document. The page numbers are 1-based. The map must be
      * empty (but not null) if no specific mappings are used.
      *
@@ -109,14 +109,19 @@ public class Overlay implements Closeabl
      * the input document was passed by {@link #setInputPDF(PDDocument) setInputPDF(PDDocument)}
      * then it is that object that is returned.
      *
-     * @throws IOException if something went wrong
+     * @throws IOException if something went wrong.
+     * @throws IllegalArgumentException if the input document is missing.
      */
-    public PDDocument overlay(Map<Integer, String> specificPageOverlayFile) throws IOException
+    public PDDocument overlay(Map<Integer, String> specificPageOverlayMap) throws IOException
     {
+        if (inputPDFDocument == null)
+        {
+            throw new IllegalArgumentException("No input document");
+        }
         Map<String, LayoutPage> layouts = new HashMap<>();
         String path;
         loadPDFs();
-        for (Map.Entry<Integer, String> e : specificPageOverlayFile.entrySet())
+        for (Map.Entry<Integer, String> e : specificPageOverlayMap.entrySet())
         {
             path = e.getValue();
             LayoutPage layoutPage = layouts.get(path);