logback-android/src/main/java/ch/qos/logback/core/net/ssl/KeyStoreFactoryBean.java
public KeyStore createKeyStore() throws NoSuchProviderException,
      NoSuchAlgorithmException, KeyStoreException {

    if (getLocation() == null) {
      throw new IllegalArgumentException("location is required");
    }

    InputStream inputStream = null;
    try {
      URL url = LocationUtil.urlForResource(getLocation());
      inputStream = url.openStream();
      KeyStore keyStore = newKeyStore();
      keyStore.load(inputStream, getPassword().toCharArray());
      return keyStore;
    }
    catch (NoSuchProviderException ex) {
      throw new NoSuchProviderException("no such keystore provider: "
            + getProvider());
    }
    catch (NoSuchAlgorithmException ex) {
      throw new NoSuchAlgorithmException("no such keystore type: "
          + getType());
    }
    catch (FileNotFoundException ex) {
      throw new KeyStoreException(getLocation() + ": file not found");
    }
    catch (Exception ex) {
      throw new KeyStoreException(getLocation() + ": " + ex.getMessage(), ex);
    }
    finally {
      try {
        if (inputStream != null) {
          inputStream.close();
        }
      }
      catch (IOException ex) {
        ex.printStackTrace(System.err);
      }
    }
  }
public KeyStore createKeyStore() throws NoSuchProviderException,
      NoSuchAlgorithmException, KeyStoreException {

    if (getLocation() == null) {
      throw new IllegalArgumentException("location is required");
    }

    InputStream inputStream = null;
    try {
      URL url = LocationUtil.urlForResource(getLocation());
      inputStream = url.openStream();
      KeyStore keyStore = newKeyStore();
      keyStore.load(inputStream, getPassword().toCharArray());
      return keyStore;
    }
    catch (NoSuchProviderException ex) {
      throw new NoSuchProviderException("no such keystore provider: "
            + getProvider());
    }
    catch (NoSuchAlgorithmException ex) {
      throw new NoSuchAlgorithmException("no such keystore type: "
          + getType());
    }
    catch (FileNotFoundException ex) {
      throw new KeyStoreException(getLocation() + ": file not found");
    }
    catch (Exception ex) {
      throw new KeyStoreException(getLocation() + ": " + ex.getMessage(), ex);
    }
    finally {
      try {
        if (inputStream != null) {
          inputStream.close();
        }
      }
      catch (IOException ex) {
        ex.printStackTrace(System.err);
      }
    }
  }
Creates a new {@link KeyStore} using the receiver's configuration.
@return key store
@throws NoSuchProviderException if the provider specified by
{@link #setProvider(String)} is not known to the platform
@throws NoSuchAlgorithmException if the key store type specified by
{@link #setType(String)} is not known to the specified provider
(or the platform's default provider if the provider isn't specified)
@throws KeyStoreException if some other error occurs in loading
the key store from the resource specified by
{@link #setLocation(String)}