mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -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());
|
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
|
||||||
assertThatExceptionOfType(RuntimeException.class)
|
assertThatExceptionOfType(RuntimeException.class)
|
||||||
.isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg))
|
.isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg))
|
||||||
.withMessageMatching("Unable to load the keystore. Please check.");
|
.withMessageMatching("Unable to load the keystore: .*");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -192,7 +192,7 @@ public class SSLKsFactoryTest {
|
|||||||
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
|
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
|
||||||
assertThatExceptionOfType(RuntimeException.class)
|
assertThatExceptionOfType(RuntimeException.class)
|
||||||
.isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg))
|
.isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg))
|
||||||
.withMessageMatching("Unable to load the truststore. Please check.");
|
.withMessageMatching("Unable to load the truststore: .*");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -98,7 +98,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
try {
|
try {
|
||||||
return KeyStore.getInstance(new File(ksPath), keyStorePassword);
|
return KeyStore.getInstance(new File(ksPath), keyStorePassword);
|
||||||
} catch (Exception e) {
|
} 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);
|
}).orElse(null);
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
.map(String::toCharArray)
|
.map(String::toCharArray)
|
||||||
.orElse(null));
|
.orElse(null));
|
||||||
} catch (Exception e) {
|
} 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);
|
}).orElse(null);
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
return cf.generateCertificate(is);
|
return cf.generateCertificate(is);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(
|
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
|
e
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
keyStore.setKeyEntry("key", key, keyPassword,
|
keyStore.setKeyEntry("key", key, keyPassword,
|
||||||
cert != null ? new Certificate[]{cert} : null);
|
cert != null ? new Certificate[]{cert} : null);
|
||||||
} catch (Exception e) {
|
} 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),
|
keyFile),
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
ts.setCertificateEntry("caCertFile", caCert);
|
ts.setCertificateEntry("caCertFile", caCert);
|
||||||
return ts;
|
return ts;
|
||||||
} catch (Exception e) {
|
} 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),
|
caCertFilePath),
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||||
kmf.init(keyStore, keyPassword);
|
kmf.init(keyStore, keyPassword);
|
||||||
} catch (Exception e) {
|
} 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;
|
TrustManagerFactory tmf;
|
||||||
@ -191,7 +191,7 @@ public class SSLKsFactory implements NBMapConfigurable {
|
|||||||
tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||||
tmf.init(trustStore != null ? trustStore : keyStore);
|
tmf.init(trustStore != null ? trustStore : keyStore);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Unable to init TrustManagerFactory. Please check.", e);
|
throw new RuntimeException("Unable to init TrustManagerFactory: " + e, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user