<commit_before>package org.synyx.urlaubsverwaltung.core.keys;

import org.apache.log4j.Logger;

import org.springframework.stereotype.Service;

import org.synyx.urlaubsverwaltung.core.person.Person;
import org.synyx.urlaubsverwaltung.core.util.CryptoUtil;

import java.security.KeyPair;
import java.security.NoSuchAlgorithmException;


/**
 * Service to generate key pair (private key and public key) for {@link Person}s.
 *
 * @author  <NAME> - <EMAIL>
 */
@Service
public class KeyPairService {

    private static final Logger LOG = Logger.getLogger(KeyPairService.class);

    /**
     * Generates a key pair for the person with the given username.
     *
     * @param  username  of the person to create the key pair for
     *
     * @return  the created key pair
     */
    public KeyPair generate(String username) {

        try {
            return CryptoUtil.generateKeyPair();
        } catch (NoSuchAlgorithmException ex) {
            LOG.error("An error occurred while trying to generate a key pair for the person with username = "
                + username, ex);

            throw new IllegalStateException(
                "Could not generate key pair. Check the algorithm used for key pair generation!");
        }
    }
}
<commit_msg>Technical: avoid that cause exceptions are lost<commit_after>package org.synyx.urlaubsverwaltung.core.keys;

import org.apache.log4j.Logger;

import org.springframework.stereotype.Service;

import org.synyx.urlaubsverwaltung.core.person.Person;
import org.synyx.urlaubsverwaltung.core.util.CryptoUtil;

import java.security.KeyPair;
import java.security.NoSuchAlgorithmException;


/**
 * Service to generate key pair (private key and public key) for {@link Person}s.
 *
 * @author  <NAME> - <EMAIL>
 */
@Service
public class KeyPairService {

    private static final Logger LOG = Logger.getLogger(KeyPairService.class);

    /**
     * Generates a key pair for the person with the given username.
     *
     * @param  username  of the person to create the key pair for
     *
     * @return  the created key pair
     */
    public KeyPair generate(String username) {

        try {
            return CryptoUtil.generateKeyPair();
        } catch (NoSuchAlgorithmException ex) {
            LOG.error("An error occurred while trying to generate a key pair for the person with username = "
                + username, ex);

            throw new IllegalStateException(
                "Could not generate key pair. Check the algorithm used for key pair generation!", ex);
        }
    }
}

{'fraction_non_alphanumeric': 0.08398744113029827, 'fraction_numerical': 0.0007849293563579278, 'mean_word_length': 2.8504531722054383, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3229733', 'n_tokens_mistral': 725, 'n_tokens_neox': 703, 'n_words': 227}