pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1790138 - in /pdfbox/trunk: examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
Date Tue, 04 Apr 2017 15:37:23 GMT
Author: tilman
Date: Tue Apr  4 15:37:22 2017
New Revision: 1790138

URL: http://svn.apache.org/viewvc?rev=1790138&view=rev
Log:
PDFBOX-3743: javadoc and comment explaining that signatureOptions should not go out of scope
before saving is finished

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java?rev=1790138&r1=1790137&r2=1790138&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
Tue Apr  4 15:37:22 2017
@@ -248,8 +248,11 @@ public class CreateVisibleSignature exte
         }
         doc.close();
         
-        // do not close options before saving, because some COSStream objects within options

+        // Do not close signatureOptions before saving, because some COSStream objects within
         // are transferred to the signed document.
+        // Do not allow signatureOptions get out of scope before saving, because then the
COSDocument
+        // in signature options might by closed by gc, which would close COSStream objects
prematurely.
+        // See https://issues.apache.org/jira/browse/PDFBOX-3743
         IOUtils.closeQuietly(signatureOptions);
     }
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java?rev=1790138&r1=1790137&r2=1790138&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
Tue Apr  4 15:37:22 2017
@@ -148,7 +148,9 @@ public class SignatureOptions implements
     }
 
     /**
-     * Closes the visual signature COSDocument, if any.
+     * Closes the visual signature COSDocument, if any. Do not call this before you're saved
your
+     * signed PDF document, or saving will fail because COSStream objects held both by the
+     * COSDocument and by the signed document would no longer be available.
      *
      * @throws IOException if the document could not be closed
      */



Mime
View raw message