X509CRLImpl: fix getRevokedCertificate by serial

The getRevokedCertificate(BigInteger) was scanning nonIndirectEntries,
but it didn't check "isIndirectCRL" first.

Change-Id: Ib1ca31d563c6bd9c62901a9eae9bea1bd92a1d9b
diff --git a/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CRLImpl.java b/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CRLImpl.java
index 68ec38a..de5bbfa 100644
--- a/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CRLImpl.java
+++ b/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CRLImpl.java
@@ -297,10 +297,20 @@
         if (entries == null) {
             return null;
         }
-        for (int i=0; i<nonIndirectEntriesSize; i++) {
-            X509CRLEntry entry = (X509CRLEntry) entries.get(i);
-            if (serialNumber.equals(entry.getSerialNumber())) {
-                return entry;
+        if (isIndirectCRL) {
+            for (int i = 0; i < nonIndirectEntriesSize; i++) {
+                X509CRLEntry entry = (X509CRLEntry) entries.get(i);
+                if (serialNumber.equals(entry.getSerialNumber())
+                        && entry.getCertificateIssuer() == null) {
+                    return entry;
+                }
+            }
+        } else {
+            for (int i = 0; i < entriesSize; i++) {
+                X509CRLEntry entry = (X509CRLEntry) entries.get(i);
+                if (serialNumber.equals(entry.getSerialNumber())) {
+                    return entry;
+                }
             }
         }
         return null;