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 2019/06/08 08:46:36 UTC

svn commit: r1860817 - /pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java

Author: tilman
Date: Sat Jun  8 08:46:36 2019
New Revision: 1860817

URL: http://svn.apache.org/viewvc?rev=1860817&view=rev
Log:
PDFBOX-4071: add cast / type; avoid "unchecked" warnings

Modified:
    pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java

Modified: pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java?rev=1860817&r1=1860816&r2=1860817&view=diff
==============================================================================
--- pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java (original)
+++ pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java Sat Jun  8 08:46:36 2019
@@ -235,9 +235,9 @@ public final class ShowSignature
 
                                 if (sig.getSignDate() != null)
                                 {
-                                    verifyCertificateChain(new JcaCertStore(certs),
-                                            cert,
-                                            sig.getSignDate().getTime());
+                                    @SuppressWarnings("unchecked")
+                                    Store<X509CertificateHolder> store = new JcaCertStore(certs);
+                                    verifyCertificateChain(store, cert, sig.getSignDate().getTime());
                                 }
                             }
                         }
@@ -444,8 +444,9 @@ public final class ShowSignature
             // https://www.quovadisglobal.com/~/media/Files/Repository/QV_RCA1_RCA3_CPCPS_V4_11.ashx
             // also 021496.pdf and 036351.pdf from digitalcorpora
             validateTimestampToken(timeStampToken);
+            @SuppressWarnings("unchecked") // TimeStampToken.getSID() is untyped
             Collection<X509CertificateHolder> tstMatches =
-                timeStampToken.getCertificates().getMatches(timeStampToken.getSID());
+                timeStampToken.getCertificates().getMatches((Selector<X509CertificateHolder>) timeStampToken.getSID());
             X509CertificateHolder tstCertHolder = tstMatches.iterator().next();
             X509Certificate certFromTimeStamp = new JcaX509CertificateConverter().getCertificate(tstCertHolder);
             // merge both stores using a set to remove duplicates
@@ -582,8 +583,9 @@ public final class ShowSignature
             throws IOException, CertificateException, TSPException, OperatorCreationException
     {
         // https://stackoverflow.com/questions/42114742/
+        @SuppressWarnings("unchecked") // TimeStampToken.getSID() is untyped
         Collection<X509CertificateHolder> tstMatches =
-                timeStampToken.getCertificates().getMatches(timeStampToken.getSID());
+                timeStampToken.getCertificates().getMatches((Selector<X509CertificateHolder>) timeStampToken.getSID());
         X509CertificateHolder holder = tstMatches.iterator().next();
         X509Certificate tstCert = new JcaX509CertificateConverter().getCertificate(holder);
         SignerInformationVerifier siv = new JcaSimpleSignerInfoVerifierBuilder().setProvider(SecurityProvider.getProvider()).build(tstCert);