pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1846675 - /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/CertInformationCollector.java
Date Thu, 15 Nov 2018 20:12:29 GMT
Author: tilman
Date: Thu Nov 15 20:12:28 2018
New Revision: 1846675

URL: http://svn.apache.org/viewvc?rev=1846675&view=rev
Log:
PDFBOX-4071: improve misleading field name; improve javadoc

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/CertInformationCollector.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/CertInformationCollector.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/CertInformationCollector.java?rev=1846675&r1=1846674&r2=1846675&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/CertInformationCollector.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/CertInformationCollector.java
Thu Nov 15 20:12:28 2018
@@ -67,9 +67,7 @@ public class CertInformationCollector
 
     private static final int MAX_CERTIFICATE_CHAIN_DEPTH = 5;
 
-    //TODO certificateStore name misleading, this is a map.
-    // even more confusing: there are also "certificatesStore" variables that are a Store
-    private final Map<BigInteger, X509Certificate> certificateStore = new HashMap<>();
+    private final Map<BigInteger, X509Certificate> certificatesMap = new HashMap<>();
 
     private final JcaX509CertificateConverter certConverter = new JcaX509CertificateConverter();
 
@@ -209,10 +207,10 @@ public class CertInformationCollector
      * not yet practicable.
      *
      * @param certificatesStore To get the certificate information from. Certificates will
be saved
-     * in the certificateStore.
+     * in certificatesMap.
      * @param signedData to get SignerInformation off
      * @param certInfo where to add certificate information
-     * @return Signer Information of the processed certificate Store for further usage.
+     * @return Signer Information of the processed certificatesStore for further usage.
      * @throws IOException on data-processing error
      * @throws CertificateProccessingException on a specific error with a certificate
      */
@@ -279,7 +277,7 @@ public class CertInformationCollector
             return;
         }
 
-        for (X509Certificate issuer : certificateStore.values())
+        for (X509Certificate issuer : certificatesMap.values())
         {
             if (CertInformationHelper.verify(certificate, issuer.getPublicKey()))
             {
@@ -333,21 +331,20 @@ public class CertInformationCollector
     }
 
     /**
-     * Adds the given Certificate to the certificateStore, if not yet containing.
+     * Adds the given Certificate to the certificatesMap, if not yet containing.
      * 
-     * @param certificate to add to the certificateStore
+     * @param certificate to add to the certificatesMap
      */
     private void addCertToCertStore(X509Certificate certificate)
     {
-        if (!certificateStore.containsKey(certificate.getSerialNumber()))
+        if (!certificatesMap.containsKey(certificate.getSerialNumber()))
         {
-            certificateStore.put(certificate.getSerialNumber(), certificate);
+            certificatesMap.put(certificate.getSerialNumber(), certificate);
         }
     }
 
     /**
-     * Gets the X509Certificate out of the X509CertificateHolder and add it to
-     * the certificateStore map.
+     * Gets the X509Certificate out of the X509CertificateHolder and add it to certificatesMap.
      *
      * @param certificateHolder to get the certificate from
      * @return a X509Certificate or <code>null</code> when there was an Error
with the Certificate
@@ -357,12 +354,12 @@ public class CertInformationCollector
             throws CertificateProccessingException
     {
         //TODO getCertFromHolder violates "do one thing" rule (adds to the map and returns
a certificate)
-        if (!certificateStore.containsKey(certificateHolder.getSerialNumber()))
+        if (!certificatesMap.containsKey(certificateHolder.getSerialNumber()))
         {
             try
             {
                 X509Certificate certificate = certConverter.getCertificate(certificateHolder);
-                certificateStore.put(certificate.getSerialNumber(), certificate);
+                certificatesMap.put(certificate.getSerialNumber(), certificate);
                 return certificate;
             }
             catch (CertificateException e)
@@ -373,7 +370,7 @@ public class CertInformationCollector
         }
         else
         {
-            return certificateStore.get(certificateHolder.getSerialNumber());
+            return certificatesMap.get(certificateHolder.getSerialNumber());
         }
     }
 
@@ -400,7 +397,7 @@ public class CertInformationCollector
 
     /**
      * Gets a list of X509Certificate out of an array of X509CertificateHolder. The certificates
-     * will be added to the certificateStore.
+     * will be added to certificatesMap.
      *
      * @param certHolders Array of X509CertificateHolder
      * @throws CertificateProccessingException when one of the Certificates could not be
parsed.
@@ -415,13 +412,13 @@ public class CertInformationCollector
     }
 
     /**
-     * Get the certificate store of all processed certificates until now.
+     * Get the map of all processed certificates until now.
      * 
      * @return a map of serial numbers to certificates.
      */
-    public Map<BigInteger, X509Certificate> getCertificateStore()
+    public Map<BigInteger, X509Certificate> getCertificatesMap()
     {
-        return certificateStore;
+        return certificatesMap;
     }
 
     /**



Mime
View raw message