Author: sebb
Date: Sat Feb  3 05:34:12 2007
New Revision: 503204

URL: http://svn.apache.org/viewvc?view=rev&rev=503204
Log:
No point checking an empty keystore and then complaining if it is empty.

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/keystore/DefaultKeyStore.java

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/keystore/DefaultKeyStore.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/keystore/DefaultKeyStore.java?view=diff&rev=503204&r1=503203&r2=503204
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/keystore/DefaultKeyStore.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/keystore/DefaultKeyStore.java
 Sat Feb  3 05:34:12 2007
@@ -29,7 +29,6 @@
  * Use this Keystore to wrap the normal KeyStore implementation.
  * 
  * @author <a href="[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision$ $Date$
  */
 public class DefaultKeyStore extends JmeterKeyStore {
        private X509Certificate[] certChain;
@@ -49,29 +48,32 @@
                PrivateKey _key = null;
                X509Certificate[] _certChain = null;
 
-               Enumeration aliases = store.aliases();
-               while (aliases.hasMoreElements()) {
-                       this.alias = (String) aliases.nextElement();
-                       if (store.isKeyEntry(alias)) {
-                               _key = (PrivateKey) store.getKey(alias, 
pword.toCharArray());
-                               Certificate[] chain = 
store.getCertificateChain(alias);
-                               _certChain = new X509Certificate[chain.length];
-
-                               for (int i = 0; i < chain.length; i++) {
-                                       _certChain[i] = (X509Certificate) 
chain[i];
+               if (null != is){ // No point checking an empty keystore
+                       
+                       Enumeration aliases = store.aliases();
+                       while (aliases.hasMoreElements()) {
+                               this.alias = (String) aliases.nextElement();
+                               if (store.isKeyEntry(alias)) {
+                                       _key = (PrivateKey) store.getKey(alias, 
pword.toCharArray());
+                                       Certificate[] chain = 
store.getCertificateChain(alias);
+                                       _certChain = new 
X509Certificate[chain.length];
+       
+                                       for (int i = 0; i < chain.length; i++) {
+                                               _certChain[i] = 
(X509Certificate) chain[i];
+                                       }
+       
+                                       break;
                                }
-
-                               break;
                        }
-               }
 
-               if (null == _key) {
-                       throw new Exception("No key found");
-               }
-               if (null == _certChain) {
-                       throw new Exception("No certificate chain found");
+                       if (null == _key) {
+                               throw new Exception("No key found");
+                       }
+                       if (null == _certChain) {
+                               throw new Exception("No certificate chain 
found");
+                       }
                }
-
+               
                this.key = _key;
                this.certChain = _certChain;
        }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to