提交 0fb30dd9 编写于 作者: I igerasim

8081744: Clear out list corner case

Reviewed-by: mullan, rhalade
上级 0cc59e1d
...@@ -1041,20 +1041,17 @@ class RevocationChecker extends PKIXRevocationChecker { ...@@ -1041,20 +1041,17 @@ class RevocationChecker extends PKIXRevocationChecker {
boolean signFlag = true; boolean signFlag = true;
List<? extends Certificate> cpList = List<? extends Certificate> cpList =
cpbr.getCertPath().getCertificates(); cpbr.getCertPath().getCertificates();
if (cpList.isEmpty()) {
return;
}
try { try {
for (int i = cpList.size()-1; i >= 0; i-- ) { for (int i = cpList.size() - 1; i >= 0; i--) {
X509Certificate cert = (X509Certificate)cpList.get(i); X509Certificate cert = (X509Certificate) cpList.get(i);
if (debug != null) { if (debug != null) {
debug.println("RevocationChecker.buildToNewKey()" debug.println("RevocationChecker.buildToNewKey()"
+ " index " + i + " checking " + " index " + i + " checking "
+ cert); + cert);
} }
checkCRLs(cert, prevKey2, null, signFlag, true, checkCRLs(cert, prevKey2, null, signFlag, true,
stackedCerts, newAnchors); stackedCerts, newAnchors);
signFlag = certCanSignCrl(cert); signFlag = certCanSignCrl(cert);
prevKey2 = cert.getPublicKey(); prevKey2 = cert.getPublicKey();
} }
...@@ -1073,8 +1070,10 @@ class RevocationChecker extends PKIXRevocationChecker { ...@@ -1073,8 +1070,10 @@ class RevocationChecker extends PKIXRevocationChecker {
// If it doesn't check out, try to find a different key. // If it doesn't check out, try to find a different key.
// And if we can't find a key, then return false. // And if we can't find a key, then return false.
PublicKey newKey = cpbr.getPublicKey(); PublicKey newKey = cpbr.getPublicKey();
X509Certificate newCert = cpList.isEmpty() ?
null : (X509Certificate) cpList.get(0);
try { try {
checkCRLs(currCert, newKey, (X509Certificate) cpList.get(0), checkCRLs(currCert, newKey, newCert,
true, false, null, params.trustAnchors()); true, false, null, params.trustAnchors());
// If that passed, the cert is OK! // If that passed, the cert is OK!
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册