pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1855009 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
Date Thu, 07 Mar 2019 20:49:47 GMT
Author: tilman
Date: Thu Mar  7 20:49:46 2019
New Revision: 1855009

URL: http://svn.apache.org/viewvc?rev=1855009&view=rev
Log:
PDFBOX-4436: use direct objects, as suggested by Till Weiss

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java?rev=1855009&r1=1855008&r2=1855009&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
Thu Mar  7 20:49:46 2019
@@ -502,13 +502,13 @@ public class PDEncryption
      */
     public void setCryptFilterDictionary(COSName cryptFilterName, PDCryptFilterDictionary
cryptFilterDictionary)
     {
-        COSDictionary cfDictionary = (COSDictionary)dictionary.getDictionaryObject( COSName.CF
);
+        COSDictionary cfDictionary = dictionary.getCOSDictionary(COSName.CF);
         if (cfDictionary == null)
         {
             cfDictionary = new COSDictionary();
             dictionary.setItem(COSName.CF, cfDictionary);
         }
-        
+        cfDictionary.setDirect(true); // PDFBOX-4436 direct obj needed for Adobe Reader on
Android
         cfDictionary.setItem(cryptFilterName, cryptFilterDictionary.getCOSDictionary());
     }
     
@@ -519,16 +519,18 @@ public class PDEncryption
      */
     public void setStdCryptFilterDictionary(PDCryptFilterDictionary cryptFilterDictionary)
     {
+        cryptFilterDictionary.getCOSDictionary().setDirect(true); // PDFBOX-4436
         setCryptFilterDictionary(COSName.STD_CF, cryptFilterDictionary);
     }
 
     /**
      * Sets the default crypt filter (for public-key security handler).
-     * 
+     *
      * @param defaultFilterDictionary the standard crypt filter to set
      */
     public void setDefaultCryptFilterDictionary(PDCryptFilterDictionary defaultFilterDictionary)
     {
+        defaultFilterDictionary.getCOSDictionary().setDirect(true); // PDFBOX-4436
         setCryptFilterDictionary(COSName.DEFAULT_CRYPT_FILTER, defaultFilterDictionary);
     }
 



Mime
View raw message