jdk/src/share/classes/sun/security/provider/certpath/IndexedCollectionCertStore.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
child 12860 9ffbd4e43413
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   183                 List<X509Certificate> list = new ArrayList<X509Certificate>(2);
   183                 List<X509Certificate> list = new ArrayList<X509Certificate>(2);
   184                 list.add(cert);
   184                 list.add(cert);
   185                 list.add((X509Certificate)oldEntry);
   185                 list.add((X509Certificate)oldEntry);
   186                 certSubjects.put(subject, list);
   186                 certSubjects.put(subject, list);
   187             } else {
   187             } else {
       
   188                 @SuppressWarnings("unchecked") // See certSubjects javadoc.
   188                 List<X509Certificate> list = (List<X509Certificate>)oldEntry;
   189                 List<X509Certificate> list = (List<X509Certificate>)oldEntry;
   189                 if (list.contains(cert) == false) {
   190                 if (list.contains(cert) == false) {
   190                     list.add(cert);
   191                     list.add(cert);
   191                 }
   192                 }
   192                 certSubjects.put(subject, list);
   193                 certSubjects.put(subject, list);
   208                 List<X509CRL> list = new ArrayList<X509CRL>(2);
   209                 List<X509CRL> list = new ArrayList<X509CRL>(2);
   209                 list.add(crl);
   210                 list.add(crl);
   210                 list.add((X509CRL)oldEntry);
   211                 list.add((X509CRL)oldEntry);
   211                 crlIssuers.put(issuer, list);
   212                 crlIssuers.put(issuer, list);
   212             } else {
   213             } else {
       
   214                 // See crlIssuers javadoc.
       
   215                 @SuppressWarnings("unchecked")
   213                 List<X509CRL> list = (List<X509CRL>)oldEntry;
   216                 List<X509CRL> list = (List<X509CRL>)oldEntry;
   214                 if (list.contains(crl) == false) {
   217                 if (list.contains(crl) == false) {
   215                     list.add(crl);
   218                     list.add(crl);
   216                 }
   219                 }
   217                 crlIssuers.put(issuer, list);
   220                 crlIssuers.put(issuer, list);
   277                     return Collections.singleton(x509Entry);
   280                     return Collections.singleton(x509Entry);
   278                 } else {
   281                 } else {
   279                     return Collections.<X509Certificate>emptySet();
   282                     return Collections.<X509Certificate>emptySet();
   280                 }
   283                 }
   281             } else {
   284             } else {
       
   285                 // See certSubjects javadoc.
       
   286                 @SuppressWarnings("unchecked")
   282                 List<X509Certificate> list = (List<X509Certificate>)entry;
   287                 List<X509Certificate> list = (List<X509Certificate>)entry;
   283                 Set<X509Certificate> matches = new HashSet<X509Certificate>(16);
   288                 Set<X509Certificate> matches = new HashSet<X509Certificate>(16);
   284                 for (X509Certificate cert : list) {
   289                 for (X509Certificate cert : list) {
   285                     if (x509Selector.match(cert)) {
   290                     if (x509Selector.match(cert)) {
   286                         matches.add(cert);
   291                         matches.add(cert);
   307                 X509Certificate cert = (X509Certificate)obj;
   312                 X509Certificate cert = (X509Certificate)obj;
   308                 if (selector.match(cert)) {
   313                 if (selector.match(cert)) {
   309                     matches.add(cert);
   314                     matches.add(cert);
   310                 }
   315                 }
   311             } else {
   316             } else {
       
   317                 // See certSubjects javadoc.
       
   318                 @SuppressWarnings("unchecked")
   312                 List<X509Certificate> list = (List<X509Certificate>)obj;
   319                 List<X509Certificate> list = (List<X509Certificate>)obj;
   313                 for (X509Certificate cert : list) {
   320                 for (X509Certificate cert : list) {
   314                     if (selector.match(cert)) {
   321                     if (selector.match(cert)) {
   315                         matches.add(cert);
   322                         matches.add(cert);
   316                     }
   323                     }
   368                     X509CRL crl = (X509CRL)entry;
   375                     X509CRL crl = (X509CRL)entry;
   369                     if (x509Selector.match(crl)) {
   376                     if (x509Selector.match(crl)) {
   370                         matches.add(crl);
   377                         matches.add(crl);
   371                     }
   378                     }
   372                 } else { // List
   379                 } else { // List
       
   380                     // See crlIssuers javadoc.
       
   381                     @SuppressWarnings("unchecked")
   373                     List<X509CRL> list = (List<X509CRL>)entry;
   382                     List<X509CRL> list = (List<X509CRL>)entry;
   374                     for (X509CRL crl : list) {
   383                     for (X509CRL crl : list) {
   375                         if (x509Selector.match(crl)) {
   384                         if (x509Selector.match(crl)) {
   376                             matches.add(crl);
   385                             matches.add(crl);
   377                         }
   386                         }
   396                 X509CRL crl = (X509CRL)obj;
   405                 X509CRL crl = (X509CRL)obj;
   397                 if (selector.match(crl)) {
   406                 if (selector.match(crl)) {
   398                     matches.add(crl);
   407                     matches.add(crl);
   399                 }
   408                 }
   400             } else {
   409             } else {
       
   410                 // See crlIssuers javadoc.
       
   411                 @SuppressWarnings("unchecked")
   401                 List<X509CRL> list = (List<X509CRL>)obj;
   412                 List<X509CRL> list = (List<X509CRL>)obj;
   402                 for (X509CRL crl : list) {
   413                 for (X509CRL crl : list) {
   403                     if (selector.match(crl)) {
   414                     if (selector.match(crl)) {
   404                         matches.add(crl);
   415                         matches.add(crl);
   405                     }
   416                     }