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 2020/05/19 13:42:27 UTC

svn commit: r1877920 - /pdfbox/branches/2.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java

Author: tilman
Date: Tue May 19 13:42:27 2020
New Revision: 1877920

URL: http://svn.apache.org/viewvc?rev=1877920&view=rev
Log:
PDFBOX-3017: only the signDetached() call should throw the exception

Modified:
    pdfbox/branches/2.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java

Modified: pdfbox/branches/2.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java?rev=1877920&r1=1877919&r2=1877920&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java (original)
+++ pdfbox/branches/2.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java Tue May 19 13:42:27 2020
@@ -187,11 +187,11 @@ public class TestCreateSignature
         String outPath = outDir + getOutputFileName("signed{0}_tsa.pdf");
 
         // sign PDF (will fail due to nonce and timestamp differing)
+        CreateSignature signing1 = new CreateSignature(keystore, password.toCharArray());
+        signing1.setExternalSigning(externallySign);
         try
         {
-            CreateSignature signing = new CreateSignature(keystore, password.toCharArray());
-            signing.setExternalSigning(externallySign);
-            signing.signDetached(new File(inPath), new File(outPath), brokenMockTSA);
+            signing1.signDetached(new File(inPath), new File(outPath), brokenMockTSA);
             Assert.fail("This should have failed");
         }
         catch (IOException e)
@@ -208,9 +208,9 @@ public class TestCreateSignature
             return;
         }
 
-        CreateSignature signing = new CreateSignature(keystore, password.toCharArray());
-        signing.setExternalSigning(externallySign);
-        signing.signDetached(new File(inPath), new File(outPath), tsa);
+        CreateSignature signing2 = new CreateSignature(keystore, password.toCharArray());
+        signing2.setExternalSigning(externallySign);
+        signing2.signDetached(new File(inPath), new File(outPath), tsa);
         checkSignature(new File(inPath), new File(outPath));
         System.out.println("TSA test successful");
     }