src/plugin/protocol-htmlunit/src/java/org/apache/nutch/protocol/htmlunit/DummyX509TrustManager.java [32:95]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class DummyX509TrustManager implements X509TrustManager {
  private X509TrustManager standardTrustManager = null;

  /**
   * Constructor for DummyX509TrustManager.
   * @param keystore a initialized {@link java.security.KeyStore}
   * @throws NoSuchAlgorithmException if there is a fatal error obtaining a
   * {@link javax.net.ssl.TrustManagerFactory} for the default algorithm.
   * @see TrustManagerFactory#getDefaultAlgorithm()
   * @throws KeyStoreException if there is a fatal error initializing the 
   * {@link javax.net.ssl.TrustManagerFactory} with the provided keystore.
   */
  public DummyX509TrustManager(KeyStore keystore)
      throws NoSuchAlgorithmException, KeyStoreException {
    super();
    String algo = TrustManagerFactory.getDefaultAlgorithm();
    TrustManagerFactory factory = TrustManagerFactory.getInstance(algo);
    factory.init(keystore);
    TrustManager[] trustmanagers = factory.getTrustManagers();
    if (trustmanagers.length == 0) {
      throw new NoSuchAlgorithmException(algo + " trust manager not supported");
    }
    this.standardTrustManager = (X509TrustManager) trustmanagers[0];
  }

  /**
   * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],
   *      String)
   * @param certificates a {@link java.security.cert.X509Certificate} array
   * @return true if trusted, false otherwise
   */
  public boolean isClientTrusted(X509Certificate[] certificates) {
    return true;
  }

  /**
   * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],
   *      String)
   * @param certificates a {@link java.security.cert.X509Certificate} array
   * @return true if trusted, false otherwise
   */
  public boolean isServerTrusted(X509Certificate[] certificates) {
    return true;
  }

  /**
   * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()
   * @return a {@link java.security.cert.X509Certificate} array
   */
  @Override
  public X509Certificate[] getAcceptedIssuers() {
    return this.standardTrustManager.getAcceptedIssuers();
  }

  @Override
  public void checkClientTrusted(X509Certificate[] arg0, String arg1)
      throws CertificateException {
    // do nothing

  }

  @Override
  public void checkServerTrusted(X509Certificate[] arg0, String arg1)
      throws CertificateException {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/plugin/protocol-interactiveselenium/src/java/org/apache/nutch/protocol/interactiveselenium/DummyX509TrustManager.java [32:95]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class DummyX509TrustManager implements X509TrustManager {
  private X509TrustManager standardTrustManager = null;

  /**
   * Constructor for DummyX509TrustManager.
   * @param keystore a initialized {@link java.security.KeyStore}
   * @throws NoSuchAlgorithmException if there is a fatal error obtaining a
   * {@link javax.net.ssl.TrustManagerFactory} for the default algorithm.
   * @see TrustManagerFactory#getDefaultAlgorithm()
   * @throws KeyStoreException if there is a fatal error initializing the 
   * {@link javax.net.ssl.TrustManagerFactory} with the provided keystore.
   */
  public DummyX509TrustManager(KeyStore keystore)
      throws NoSuchAlgorithmException, KeyStoreException {
    super();
    String algo = TrustManagerFactory.getDefaultAlgorithm();
    TrustManagerFactory factory = TrustManagerFactory.getInstance(algo);
    factory.init(keystore);
    TrustManager[] trustmanagers = factory.getTrustManagers();
    if (trustmanagers.length == 0) {
      throw new NoSuchAlgorithmException(algo + " trust manager not supported");
    }
    this.standardTrustManager = (X509TrustManager) trustmanagers[0];
  }

  /**
   * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],
   *      String)
   * @param certificates a {@link java.security.cert.X509Certificate} array
   * @return true if trusted, false otherwise
   */
  public boolean isClientTrusted(X509Certificate[] certificates) {
    return true;
  }

  /**
   * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],
   *      String)
   * @param certificates a {@link java.security.cert.X509Certificate} array
   * @return true if trusted, false otherwise
   */
  public boolean isServerTrusted(X509Certificate[] certificates) {
    return true;
  }

  /**
   * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()
   * @return a {@link java.security.cert.X509Certificate} array
   */
  @Override
  public X509Certificate[] getAcceptedIssuers() {
    return this.standardTrustManager.getAcceptedIssuers();
  }

  @Override
  public void checkClientTrusted(X509Certificate[] arg0, String arg1)
      throws CertificateException {
    // do nothing

  }

  @Override
  public void checkServerTrusted(X509Certificate[] arg0, String arg1)
      throws CertificateException {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



