This is an automated email from the ASF dual-hosted git repository.
fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new bc23dca Be more specific when handling errors while loading keystores
bc23dca is described below
commit bc23dca0db49d8434ed4cb4937b8acec81e19f00
Author: Felix Schumacher <[email protected]>
AuthorDate: Sat Sep 11 11:58:06 2021 +0200
Be more specific when handling errors while loading keystores
Currently a user can not differentiate between a wrong password and missing
or
wrong keys, algorithms, etc. So try do handle the excpetions, that the API
gives us and log different error messages to better inform our users.
Part of #654
---
.../src/main/java/org/apache/jmeter/util/SSLManager.java | 16 ++++++++++++----
xdocs/changes.xml | 1 +
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/core/src/main/java/org/apache/jmeter/util/SSLManager.java
b/src/core/src/main/java/org/apache/jmeter/util/SSLManager.java
index 5ebd3a5..cb57eec 100644
--- a/src/core/src/main/java/org/apache/jmeter/util/SSLManager.java
+++ b/src/core/src/main/java/org/apache/jmeter/util/SSLManager.java
@@ -154,8 +154,16 @@ public abstract class SSLManager {
this.keyStore.load(null, "");
}
}
- } catch (Exception e) {
- log.error("Problem loading keystore: {}", e.getMessage(), e);
+ } catch (IOException e) {
+ log.error("Can't load keystore '{}'. Wrong password?",
fileName, e);
+ } catch (UnrecoverableKeyException e) {
+ log.error("Can't recover keys from keystore '{}'", fileName, e);
+ } catch (NoSuchAlgorithmException e) {
+ log.error("Problem finding the correct algorithm while loading
keys from keystore '{}'", fileName, e);
+ } catch (CertificateException e) {
+ log.error("Problem with one of the certificates/keys in
keystore '{}'", fileName, e);
+ } catch (KeyStoreException e) {
+ log.error("Problem loading keystore: {}", e.getMessage(), e);
}
if (log.isDebugEnabled()) {
@@ -167,7 +175,7 @@ public abstract class SSLManager {
}
private void retryLoadKeys(File initStore, boolean allowEmptyPassword)
throws NoSuchAlgorithmException,
- CertificateException, IOException, KeyStoreException,
UnrecoverableKeyException {
+ CertificateException, KeyStoreException, UnrecoverableKeyException
{
for (int i = 0; i < 3; i++) {
String password = getPassword();
if (!allowEmptyPassword) {
@@ -183,7 +191,7 @@ public abstract class SSLManager {
}
return;
} catch (IOException e) {
- log.debug("Could not load keystore. Wrong password for
keystore?", e);
+ log.warn("Could not load keystore '" + initStore + "'. Wrong
password for keystore?", e);
}
this.defaultpw = null;
}
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 3e8ec6e..432146e 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -174,6 +174,7 @@ Summary
to <code>user.properties</code>, as it is read from that place.
Contributed by Rithvik Patibandla (rithvikp98 at gmail.com)</li>
<li><bug>65456</bug>Updated commons-jexl 3 to 3.2.1 (from 3.1). Contributed
by Ori Marko (orimarko at gmail.com>)</li>
+ <li><pr>654<pr>Try do give better feedback while loading keystores</li>
</ul>
<!-- =================== Bug fixes =================== -->