27
27
***** END LICENSE BLOCK *****/
28
28
package org .jruby .ext .openssl .x509store ;
29
29
30
+ import java .util .Collection ;
30
31
import java .util .List ;
31
32
32
33
/**
35
36
* @author <a href="mailto:[email protected] ">Ola Bini</a>
36
37
*/
37
38
public abstract class X509Object implements Comparable <X509Object > {
39
+
38
40
/**
39
41
* c: X509_OBJECT_idx_by_subject
40
42
*/
41
- public static int indexBySubject (List <? extends X509Object > h , int type , Name name ) {
42
- int ix = 0 ;
43
- for ( X509Object oo : h ) {
44
- if ( type == oo .type () && oo .isName (name ) ) return ix ;
43
+ public static int indexBySubject (final List <? extends X509Object > list , int type , Name name ) {
44
+ for ( int i = 0 ; i < list . size (); i ++ ) {
45
+ final X509Object obj = list . get ( i );
46
+ if ( type == obj .type () && obj .isName (name ) ) return i ;
45
47
}
46
48
return -1 ;
47
49
}
48
50
49
51
/**
50
52
* c: X509_OBJECT_retrieve_by_subject
51
53
*/
52
- public static X509Object retrieveBySubject (final List <? extends X509Object > h , int type , Name name ) {
53
- for ( X509Object o : h ) {
54
- if ( type == o .type () && o .isName (name ) ) return o ;
54
+ public static X509Object retrieveBySubject (final Collection <? extends X509Object > list , int type , Name name ) {
55
+ for ( X509Object obj : list ) {
56
+ if ( type == obj .type () && obj .isName (name ) ) return obj ;
55
57
}
56
58
return null ;
57
59
}
58
60
59
61
/**
60
62
* c: X509_OBJECT_retrieve_match
61
63
*/
62
- public static X509Object retrieveMatch (final List <? extends X509Object > h , X509Object x ) {
63
- for ( X509Object o : h ) {
64
- if ( o .matches (x ) ) return o ;
64
+ public static X509Object retrieveMatch (final Collection <? extends X509Object > list , X509Object x ) {
65
+ for ( X509Object obj : list ) {
66
+ if ( obj .matches (x ) ) return obj ;
65
67
}
66
68
return null ;
67
69
}
@@ -79,4 +81,5 @@ public boolean matches(X509Object o) {
79
81
public int compareTo (X509Object other ) {
80
82
return type () - other .type ();
81
83
}
84
+
82
85
}// X509_OBJECT
0 commit comments