Logo Search packages:      
Sourcecode: jakarta-jmeter version File versions  Download package

KeyStore org::apache::jmeter::util::SSLManager::getTrustStore (  )  [inline, protected]

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.

  • null: use Java truststore
  • otherwise, the truststore, which may be empty if the file could not be loaded.

Definition at line 195 of file SSLManager.java.

References trustStore.

        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 {
                this.trustStore = KeyStore.getInstance("JKS");
                log.info("TrustStore created OK, Type: JKS");
            } catch (Exception e) {
                this.trustStore = null;
                throw new RuntimeException("Problem creating truststore: "+e.getMessage());

            FileInputStream fileInputStream = null;
            try {
                File initStore = new File(fileName);

                if (initStore.exists()) {
                    fileInputStream = new FileInputStream(initStore);
                    this.trustStore.load(fileInputStream, null);
                    log.info("Truststore loaded OK from file");
                } else {
                    log.info("Truststore file not found, loading empty truststore");
                    this.trustStore.load(null, null);
            } catch (Exception e) {
                throw new RuntimeException("Can't load TrustStore: " + e.toString());
            } finally {

        return this.trustStore;

Generated by  Doxygen 1.6.0   Back to index