Author: lehmi
Date: Sun Jan  6 17:46:45 2019
New Revision: 1850577

URL: http://svn.apache.org/viewvc?rev=1850577&view=rev
Log:
PDFBOX-4071: don't create object which is replaced immediately after creation 
without further use

Modified:
    
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java

Modified: 
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java?rev=1850577&r1=1850576&r2=1850577&view=diff
==============================================================================
--- 
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java
 (original)
+++ 
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java
 Sun Jan  6 17:46:45 2019
@@ -312,11 +312,10 @@ public class TestSymmetricKeyEncryption
             PDDocument doc, String prefix, AccessPermission permission,
             String userpassword, String ownerpassword) throws IOException
     {
-        AccessPermission ap = new AccessPermission();
-        StandardProtectionPolicy spp = new 
StandardProtectionPolicy(ownerpassword, userpassword, ap);
+        StandardProtectionPolicy spp = new 
StandardProtectionPolicy(ownerpassword, userpassword,
+                permission);
         spp.setEncryptionKeyLength(keyLength);
         spp.setPreferAES(preferAES);
-        spp.setPermissions(permission);
         
         // This must have no effect and should only log a warning.
         doc.setAllSecurityToBeRemoved(true);
@@ -332,10 +331,8 @@ public class TestSymmetricKeyEncryption
                 + "-bit " + (preferAES ? "AES" : "RC4") + " encrypted pdf 
should not have same size as plain one",
                 sizeEncrypted != sizePriorToEncr);
 
-        PDDocument encryptedDoc;
-
         // test with owner password => full permissions
-        encryptedDoc = PDDocument.load(pdfFile, ownerpassword);
+        PDDocument encryptedDoc = PDDocument.load(pdfFile, ownerpassword);
         Assert.assertTrue(encryptedDoc.isEncrypted());
         
Assert.assertTrue(encryptedDoc.getCurrentAccessPermission().isOwnerPermission());
 


Reply via email to