<commit_before>package com.hp.autonomy.frontend.configuration;

import com.autonomy.frontend.configuration.AbstractConfig;
import com.autonomy.frontend.configuration.ConfigException;
import com.autonomy.frontend.configuration.Login;
import com.autonomy.frontend.configuration.LoginConfig;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.EqualsAndHashCode;
import lombok.Getter;

@JsonDeserialize(builder = FindConfig.Builder.class)
@Getter
@EqualsAndHashCode(callSuper = false)
public class FindConfig extends AbstractConfig<FindConfig> implements LoginConfig<FindConfig> {

    private final Login login;
    private final IodConfig iod;

    private FindConfig(final Builder builder) {
        this.login = builder.login;
        this.iod = builder.iod;
    }

    @Override
    public FindConfig merge(final FindConfig config) {
        if(config != null) {
            final Builder builder = new Builder();

            builder.setLogin(this.login == null ? config.login : this.login.merge(config.login));
            builder.setIod(this.iod == null ? config.iod : this.iod.merge(config.iod));

            return builder.build();
        }
        else {
            return this;
        }
    }

    @Override
    public FindConfig withoutDefaultLogin() {
        final Builder builder = new Builder(this);

        builder.login = builder.login.withoutDefaultLogin();

        return builder.build();
    }

    @Override
    public FindConfig generateDefaultLogin() {
        final Builder builder = new Builder(this);

        builder.login = builder.login.generateDefaultLogin();

        return builder.build();
    }

    public FindConfig withHashedPasswords() {
        final Builder builder = new Builder(this);

        builder.login = builder.login.withHashedPasswords();

        return builder.build();
    }

    @Override
    public void basicValidate() throws ConfigException {
        if(!this.login.getMethod().equalsIgnoreCase("default")){
            this.login.basicValidate();
        }
    }<commit_msg>Prevent password leakage by making FindConfig a PasswordsConfig [rev: ivanoaly].<commit_after>package com.hp.autonomy.frontend.configuration;

import com.autonomy.frontend.configuration.AbstractConfig;
import com.autonomy.frontend.configuration.ConfigException;
import com.autonomy.frontend.configuration.Login;
import com.autonomy.frontend.configuration.LoginConfig;
import com.autonomy.frontend.configuration.PasswordsConfig;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.jasypt.util.text.TextEncryptor;

@JsonDeserialize(builder = FindConfig.Builder.class)
@Getter
@EqualsAndHashCode(callSuper = false)
public class FindConfig extends AbstractConfig<FindConfig> implements LoginConfig<FindConfig>, PasswordsConfig<FindConfig> {

    private final Login login;
    private final IodConfig iod;

    private FindConfig(final Builder builder) {
        this.login = builder.login;
        this.iod = builder.iod;
    }

    @Override
    public FindConfig merge(final FindConfig config) {
        if(config != null) {
            final Builder builder = new Builder();

            builder.setLogin(this.login == null ? config.login : this.login.merge(config.login));
            builder.setIod(this.iod == null ? config.iod : this.iod.merge(config.iod));

            return builder.build();
        }
        else {
            return this;
        }
    }

    @Override
    public FindConfig withoutDefaultLogin() {
        final Builder builder = new Builder(this);

        builder.login = builder.login.withoutDefaultLogin();

        return builder.build();
    }

    @Override
    public FindConfig generateDefaultLogin() {
        final Builder builder = new Builder(this);

        builder.login = builder.login.generateDefaultLogin();

        return builder.build();
    }

    @Override
    public FindConfig withHashedPasswords() {
        final Builder builder = new Builder(this);

        builder.login = builder.login.withHashedPasswords();

        return builder.build();
    }

    @Override
    public void basicValidate() throws ConfigException {
        if(!this.login.getMethod().equalsIgnoreCase("default")){
            this.login.basicValidate();
        }
    }

    @Override
    public FindConfig withoutPasswords() {
        final Builder builder = new Builder(this);

        builder.login = login.withoutPasswords();

        return builder.build();
    }

    @Override
    public FindConfig withEncryptedPasswords(final TextEncryptor encryptor) {
        return this;
    }

    @Override
    public FindConfig withDecryptedPasswords(final TextEncryptor encryptor) {
        return this;
    }
{'fraction_non_alphanumeric': 0.09503459503459503, 'fraction_numerical': 0.0, 'mean_word_length': 3.1441821247892072, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116588', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1268, 'n_words': 280}