Author: sebb
Date: Sun Feb 4 11:55:14 2007
New Revision: 503467
URL: http://svn.apache.org/viewvc?view=rev&rev=503467
Log:
Allow for use of standard Java truststore
(will be needed to support conditional trust management)
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/SSLManager.java
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/SSLManager.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/SSLManager.java?view=diff&rev=503467&r1=503466&r2=503467
==============================================================================
---
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/SSLManager.java
(original)
+++
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/SSLManager.java
Sun Feb 4 11:55:14 2007
@@ -67,8 +67,10 @@
/** Cache the KeyStore instance */
private JmeterKeyStore keyStore;
- /** Cache the TrustStore instance */
- private KeyStore trustStore;
+ /** Cache the TrustStore instance - null if no truststore name was
provided */
+ private KeyStore trustStore = null;
+ // Have we yet tried to load the truststore?
+ private volatile boolean truststore_loaded=false;
/** Have the password available */
protected String defaultpw = System.getProperty(KEY_STORE_PASSWORD);
@@ -125,7 +127,7 @@
if (initStore.exists()) {
fileInputStream = new
FileInputStream(initStore);
this.keyStore.load(fileInputStream, getPassword());
- log.info("Keystore loaded OK from file");
+ log.info("Keystore loaded OK from file, found alias:
"+keyStore.getAlias());
} else {
log.warn("Keystore file not found,
loading empty keystore");
this.defaultpw = ""; // Ensure not null
@@ -176,10 +178,30 @@
/**
* Opens and initializes the TrustStore.
+ *
+ * There are 3 possibilities:
+ * - no truststore name provided, in which case the default Java
truststore should be used
+ * - truststore name is provided, and loads OK
+ * - truststore name is provided, but is not found or does not load OK,
in which case an empty
+ * truststore is created
+ *
+ * If the KeyStore object cannot be created, then this is currently
treated the same
+ * as if no truststore name was provided.
+ *
+ * @return truststore
+ * - null: use Java truststore
+ * - otherwise, the truststore, which may be empty if the file could
not be loaded.
+ *
*/
protected KeyStore getTrustStore() {
- if (null == this.trustStore) {
- String fileName = System.getProperty(SSL_TRUST_STORE,
"");
+ if (!truststore_loaded) {
+
+ truststore_loaded=true;// we've tried ...
+
+ String fileName = System.getProperty(SSL_TRUST_STORE);
+ if (fileName == null) {
+ return null;
+ }
log.info("TrustStore Location: " + fileName);
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]