pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1843320 - in /pdfbox/trunk: pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java
Date Tue, 09 Oct 2018 18:15:32 GMT
Author: tilman
Date: Tue Oct  9 18:15:32 2018
New Revision: 1843320

URL: http://svn.apache.org/viewvc?rev=1843320&view=rev
Log:
PDFBOX-4335: add @Override, close overlay object in utility (SonarQube complaints)

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.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=1843320&r1=1843319&r2=1843320&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 Tue Oct  9 18:15:32
2018
@@ -129,6 +129,7 @@ public class Overlay implements Closeabl
      * 
      * @throws IOException if something went wrong
      */
+    @Override
     public void close() throws IOException
     {
         if (defaultOverlay != null)

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java?rev=1843320&r1=1843319&r2=1843320&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java Tue Oct  9 18:15:32
2018
@@ -137,21 +137,24 @@ public final class OverlayPDF
             usage();
         }
         
-        try 
+        try
         {
             try (PDDocument result = overlayer.overlay(specificPageOverlayFile))
             {
                 result.save(outputFilename);
             }
-            // close the input files AFTER saving the resulting file as some 
-            // streams are shared among the input and the output files
-            overlayer.close();
         } 
         catch (IOException e) 
         {
             LOG.error("Overlay failed: " + e.getMessage(), e);
             throw e;
         }
+        finally
+        {
+            // close the input files AFTER saving the resulting file as some 
+            // streams are shared among the input and the output files
+            overlayer.close();
+        }
     }
 
     private static void usage()



Mime
View raw message