Example usage for com.amazonaws.util StringUtils replace

List of usage examples for com.amazonaws.util StringUtils replace

Introduction

In this page you can find the example usage for com.amazonaws.util StringUtils replace.

Prototype

public static String replace(String originalString, String partToMatch, String replacement) 

Source Link

Usage

From source file:ch.cyberduck.cli.TerminalCertificateStore.java

License:Open Source License

@Override
public boolean isTrusted(final String hostname, final List<X509Certificate> certificates) {
    if (certificates.isEmpty()) {
        return false;
    }// ww  w. ja  v a2s. c o m
    for (X509Certificate c : certificates) {
        // Checks that the certificate is currently valid.
        try {
            c.checkValidity();
        } catch (CertificateExpiredException e) {
            return prompt.prompt(LocaleFactory.localizedString(StringUtils.replace(
                    "The certificate for this server has expired. You might be connecting to a server that "
                            + "is pretending to be %@? which could put your confidential information at risk. "
                            + "Would you like to connect to the server anyway?",
                    "%@", hostname), "Keychain"));
        } catch (CertificateNotYetValidException e) {
            return prompt.prompt(LocaleFactory.localizedString(StringUtils.replace(
                    "The certificate for this server is not yet valid. You might be connecting to a server that "
                            + "is pretending to be %@? which could put your confidential information at risk. Would you like to connect to the server anyway?",
                    "%@", hostname), "Keychain"));
        }
    }
    try {
        verifier.verify(hostname, certificates.get(0));
    } catch (SSLException e) {
        return prompt.prompt(LocaleFactory.localizedString(StringUtils.replace(
                "The certificate for this server is invalid. "
                        + "You might be connecting to a server that is pretending to be %@? which could put "
                        + "your confidential information at risk. Would you like to connect to the server anyway?",
                "%@", hostname), "Keychain"));
    }
    return true;
}