7081817: test/sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java failing
authorxuelei
Mon, 22 Aug 2011 18:21:43 -0700
changeset 10358 5a4ec0a5f7ee
parent 10357 c2cde4cd24a1
child 10359 2eff81585f6b
7081817: test/sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java failing Reviewed-by: alanb, weijun
jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java
--- a/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Mon Aug 22 17:34:30 2011 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Mon Aug 22 18:21:43 2011 -0700
@@ -105,7 +105,13 @@
         super("X.509");
 
         // Ensure that the List contains only X509Certificates
-        for (Certificate obj : certs) {
+        //
+        // Note; The certs parameter is not necessarily to be of Certificate
+        // for some old code. For compatibility, to make sure the exception
+        // is CertificateException, rather than ClassCastException, please
+        // don't use
+        //     for (Certificate obj : certs)
+        for (Object obj : certs) {
             if (obj instanceof X509Certificate == false) {
                 throw new CertificateException
                     ("List is not all X509Certificates: "