mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-28 19:44:02 -06:00
make SSL errors more clear by showing the details of the caught exception
This commit is contained in:
parent
00464dbca3
commit
5bc9457364
@ -162,7 +162,7 @@ public class SSLKsFactoryTest {
|
||||
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
|
||||
assertThatExceptionOfType(RuntimeException.class)
|
||||
.isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg))
|
||||
.withMessageMatching("Unable to load the keystore. Please check.");
|
||||
.withMessageMatching("Unable to load the keystore: .*");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -192,7 +192,7 @@ public class SSLKsFactoryTest {
|
||||
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
|
||||
assertThatExceptionOfType(RuntimeException.class)
|
||||
.isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg))
|
||||
.withMessageMatching("Unable to load the truststore. Please check.");
|
||||
.withMessageMatching("Unable to load the truststore: .*");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,7 +98,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
try {
|
||||
return KeyStore.getInstance(new File(ksPath), keyStorePassword);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Unable to load the keystore. Please check.", e);
|
||||
throw new RuntimeException("Unable to load the keystore: " + e, e);
|
||||
}
|
||||
}).orElse(null);
|
||||
|
||||
@ -109,7 +109,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
.map(String::toCharArray)
|
||||
.orElse(null));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Unable to load the truststore. Please check.", e);
|
||||
throw new RuntimeException("Unable to load the truststore: " + e, e);
|
||||
}
|
||||
}).orElse(null);
|
||||
|
||||
@ -125,7 +125,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
return cf.generateCertificate(is);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(
|
||||
String.format("Unable to load cert from %s. Please check.", certFilePath),
|
||||
String.format("Unable to load cert from %s: " + e, certFilePath),
|
||||
e
|
||||
);
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
keyStore.setKeyEntry("key", key, keyPassword,
|
||||
cert != null ? new Certificate[]{cert} : null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(String.format("Unable to load key from %s. Please check.",
|
||||
throw new RuntimeException(String.format("Unable to load key from %s: " + e,
|
||||
keyFile),
|
||||
e);
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
ts.setCertificateEntry("caCertFile", caCert);
|
||||
return ts;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(String.format("Unable to load caCert from %s. Please check.",
|
||||
throw new RuntimeException(String.format("Unable to load caCert from %s: " + e,
|
||||
caCertFilePath),
|
||||
e);
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||
kmf.init(keyStore, keyPassword);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Unable to init KeyManagerFactory. Please check password and location.", e);
|
||||
throw new RuntimeException("Unable to init KeyManagerFactory. Please check password and location: " + e, e);
|
||||
}
|
||||
|
||||
TrustManagerFactory tmf;
|
||||
@ -191,7 +191,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
||||
tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||
tmf.init(trustStore != null ? trustStore : keyStore);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Unable to init TrustManagerFactory. Please check.", e);
|
||||
throw new RuntimeException("Unable to init TrustManagerFactory: " + e, e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user