[java-opensaml COMMIT] /trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java

noreply at shibboleth.net noreply at shibboleth.net
Mon Feb 2 21:27:36 EST 2015


Author: scantor
Date: Mon Feb  2 21:27:36 2015
New Revision: 4211

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4211&view=rev
Log:
OSJ-102 - Certificate parsing errors throw IllegalArgumentException

Modified:
    trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java

Modified: trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java?rev=4211&r1=4210&r2=4211&view=diff
==============================================================================
--- trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java (original)
+++ trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java Mon Feb  2 21:27:36 2015
@@ -189,7 +189,7 @@
             return null;
         }
 
-        final List<Object> altNames = new LinkedList<Object>();
+        final List<Object> altNames = new LinkedList<>();
         final GeneralNameType[] types = new GeneralNameType[nameTypes.length];
         for (int i = 0; i < nameTypes.length; i++) {
             types[i]= GeneralNameType.fromTagNumber(nameTypes[i]);
@@ -351,7 +351,11 @@
      * @throws CertificateException thrown if the certificate cannot be decoded
      */
     @Nullable public static X509Certificate decodeCertificate(@Nonnull final byte[] cert) throws CertificateException {
-        return CertUtil.decodeCertificate(cert);
+        try {
+            return CertUtil.decodeCertificate(cert);
+        } catch (final IllegalArgumentException e) {
+            throw new CertificateException(e);
+        }
     }
     
     /**



More information about the commits mailing list