<commit_before>package net.qldarch.service.rdf;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.regex.Pattern;

public class Validators {
    public static Logger logger = LoggerFactory.getLogger(Validators.class);

    public static final Pattern USERNAME_REGEX = Pattern.compile("[a-zA-Z0-9_]{3,}");

    public static String username(String username) {
        if (username == null) {
            return "";
        } else if (USERNAME_REGEX.matcher(username).matches()) {
            return username;
        } else {
            logger.warn("Invalid username provided: {}", username);
            throw new IllegalArgumentException("Invalid username");
        }
    }
}<commit_msg>Fix username validation to allow periods and hyphens<commit_after>package net.qldarch.service.rdf;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.regex.Pattern;

public class Validators {
    public static Logger logger = LoggerFactory.getLogger(Validators.class);

    public static final Pattern USERNAME_REGEX = Pattern.compile("[a-zA-Z0-9_.-]{3,}");

    public static String username(String username) {
        if (username == null) {
            return "";
        } else if (USERNAME_REGEX.matcher(username).matches()) {
            return username;
        } else {
            logger.warn("Invalid username provided: {}", username);
            throw new IllegalArgumentException("Invalid username");
        }
    }
}
{'fraction_non_alphanumeric': 0.1114887831407206, 'fraction_numerical': 0.006798096532970768, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6982801', 'n_tokens_mistral': 408, 'n_tokens_neox': 402, 'n_words': 97}