41
41
import javax .net .ssl .X509TrustManager ;
42
42
43
43
import org .jruby .Ruby ;
44
+ import org .jruby .ext .openssl .OpenSSL ;
44
45
45
46
/**
46
47
* c: X509_STORE
@@ -115,8 +116,11 @@ public int call(StoreContext context) {
115
116
116
117
// @Deprecated int cache = 1; // not-used
117
118
118
- private volatile X509Object [] objects = new X509Object [0 ];
119
- private volatile Lookup [] certLookups = new Lookup [0 ];
119
+ private static final X509Object [] NULL_OBJECTS = new X509Object [0 ];
120
+ private static final Lookup [] NULL_LOOKUP = new Lookup [0 ];
121
+
122
+ private volatile X509Object [] objects = NULL_OBJECTS ;
123
+ private volatile Lookup [] certLookups = NULL_LOOKUP ;
120
124
121
125
public final VerifyParameter verifyParameter ;
122
126
@@ -243,8 +247,8 @@ public int setTrust(int trust) {
243
247
/**
244
248
* c: X509_STORE_set1_param
245
249
*/
246
- public int setParam (VerifyParameter pm ) {
247
- return verifyParameter .set (verifyParameter );
250
+ public int setParam (VerifyParameter param ) {
251
+ return verifyParameter .set (param );
248
252
}
249
253
250
254
/**
@@ -365,7 +369,6 @@ public int loadLocations(Ruby runtime, final String file, final String path) thr
365
369
public int setDefaultPaths (Ruby runtime ) throws Exception {
366
370
367
371
Lookup lookup = addLookup (runtime , Lookup .fileLookup ());
368
- //if ( lookup == null ) return 0;
369
372
370
373
try {
371
374
lookup .loadFile (new CertificateFile .Path (null , X509_FILETYPE_DEFAULT ));
@@ -379,11 +382,10 @@ public int setDefaultPaths(Ruby runtime) throws Exception {
379
382
if (!e .getClass ().getSimpleName ().equals ("NotFound" )) {
380
383
throw e ;
381
384
}
382
- // set_default_paths ignores FileNotFound
385
+ OpenSSL . debug ( runtime , "add X509_CERT_FILER_CTX (to default paths)" , e );
383
386
}
384
387
385
388
lookup = addLookup (runtime , Lookup .hashDirLookup ());
386
- //if ( lookup == null ) return 0;
387
389
388
390
try {
389
391
lookup .addDir (new CertificateHashDir .Dir (null , X509_FILETYPE_DEFAULT ));
@@ -395,7 +397,7 @@ public int setDefaultPaths(Ruby runtime) throws Exception {
395
397
if (!e .getClass ().getSimpleName ().equals ("NotFound" )) {
396
398
throw e ;
397
399
}
398
- // set_default_paths ignores FileNotFound
400
+ OpenSSL . debug ( runtime , "add X509_HASH_DIR_CTX (to default paths)" , e );
399
401
}
400
402
401
403
X509Error .clearErrors ();
0 commit comments