protected Settings encryptSettings()

in maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/AbstractMavenExecutor.java [99:134]


    protected Settings encryptSettings(Settings settings) {
        Settings encryptedSettings = SettingsUtils.copySettings(settings);

        for (Server server : encryptedSettings.getServers()) {
            String password = server.getPassword();
            if (password != null && !mavenCrypto.isEncryptedString(password)) {
                try {
                    server.setPassword(mavenCrypto.encryptAndDecorate(password));
                } catch (MavenCryptoException e) {
                    // ignore
                }
            }

            String passphrase = server.getPassphrase();
            if (passphrase != null && !mavenCrypto.isEncryptedString(passphrase)) {
                try {
                    server.setPassphrase(mavenCrypto.encryptAndDecorate(passphrase));
                } catch (MavenCryptoException e) {
                    // ignore
                }
            }
        }

        for (Proxy proxy : encryptedSettings.getProxies()) {
            String password = proxy.getPassword();
            if (password != null && !mavenCrypto.isEncryptedString(password)) {
                try {
                    proxy.setPassword(mavenCrypto.encryptAndDecorate(password));
                } catch (MavenCryptoException e) {
                    // ignore
                }
            }
        }

        return encryptedSettings;
    }