Fix RevocationChecker IndexOutOfBoundsException
Ported from openJdk8u121
Failed to locate referenced test.
port from openjdk8u121
changeset: 9171:0157177fb61a
user: juh
date: Wed Feb 19 20:07:10 2014 -0800
summary: 8031025: SQE test CertPath/CertPathBuilderTest/* failed with java.lang.IndexOutOfBoundsException
Test: CtsLibcoreTestCases
Bug: 31028374
Change-Id: Ie5fa22cd3b90c6026c6efd6db1d179d5d1cd6eb9
diff --git a/ojluni/src/main/java/sun/security/provider/certpath/RevocationChecker.java b/ojluni/src/main/java/sun/security/provider/certpath/RevocationChecker.java
index 19b41f6..f38e7dc 100644
--- a/ojluni/src/main/java/sun/security/provider/certpath/RevocationChecker.java
+++ b/ojluni/src/main/java/sun/security/provider/certpath/RevocationChecker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1035,6 +1035,9 @@
boolean signFlag = true;
List<? extends Certificate> cpList =
cpbr.getCertPath().getCertificates();
+ if (cpList.isEmpty()) {
+ return;
+ }
try {
for (int i = cpList.size()-1; i >= 0; i-- ) {
X509Certificate cert = (X509Certificate)cpList.get(i);