Skip to content

Commit 769f910

Browse files
committed
[refactor] cleanup + debug internal swallowed exceptions
1 parent 8f58e70 commit 769f910

File tree

1 file changed

+10
-8
lines changed
  • src/main/java/org/jruby/ext/openssl/x509store

1 file changed

+10
-8
lines changed

src/main/java/org/jruby/ext/openssl/x509store/Store.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import javax.net.ssl.X509TrustManager;
4242

4343
import org.jruby.Ruby;
44+
import org.jruby.ext.openssl.OpenSSL;
4445

4546
/**
4647
* c: X509_STORE
@@ -115,8 +116,11 @@ public int call(StoreContext context) {
115116

116117
// @Deprecated int cache = 1; // not-used
117118

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;
120124

121125
public final VerifyParameter verifyParameter;
122126

@@ -243,8 +247,8 @@ public int setTrust(int trust) {
243247
/**
244248
* c: X509_STORE_set1_param
245249
*/
246-
public int setParam(VerifyParameter pm) {
247-
return verifyParameter.set(verifyParameter);
250+
public int setParam(VerifyParameter param) {
251+
return verifyParameter.set(param);
248252
}
249253

250254
/**
@@ -365,7 +369,6 @@ public int loadLocations(Ruby runtime, final String file, final String path) thr
365369
public int setDefaultPaths(Ruby runtime) throws Exception {
366370

367371
Lookup lookup = addLookup(runtime, Lookup.fileLookup());
368-
//if ( lookup == null ) return 0;
369372

370373
try {
371374
lookup.loadFile(new CertificateFile.Path(null, X509_FILETYPE_DEFAULT));
@@ -379,11 +382,10 @@ public int setDefaultPaths(Ruby runtime) throws Exception {
379382
if (!e.getClass().getSimpleName().equals("NotFound")) {
380383
throw e;
381384
}
382-
// set_default_paths ignores FileNotFound
385+
OpenSSL.debug(runtime, "add X509_CERT_FILER_CTX (to default paths)", e);
383386
}
384387

385388
lookup = addLookup(runtime, Lookup.hashDirLookup());
386-
//if ( lookup == null ) return 0;
387389

388390
try {
389391
lookup.addDir(new CertificateHashDir.Dir(null, X509_FILETYPE_DEFAULT));
@@ -395,7 +397,7 @@ public int setDefaultPaths(Ruby runtime) throws Exception {
395397
if (!e.getClass().getSimpleName().equals("NotFound")) {
396398
throw e;
397399
}
398-
// set_default_paths ignores FileNotFound
400+
OpenSSL.debug(runtime, "add X509_HASH_DIR_CTX (to default paths)", e);
399401
}
400402

401403
X509Error.clearErrors();

0 commit comments

Comments
 (0)