<commit_before>package com.alibaba.dcm.internal;

/**
 * @author <NAME> (<EMAIL>)
 */
final class IpParserUtil {
    private static final String INVALID_IPV_6_ADDRESS = ": invalid IPv6 address";
    private static final String INVALID_IP_ADDRESS = ": invalid IP address";

    /**
     * source code is dug from {@link java.net.InetAddress#getAllByName(java.lang.String, java.net.InetAddress)}
     */
    static byte[] ip2ByteArray(String ip) {

        boolean ipv6Expected = false;
        if (ip.charAt(0) == '[') {
            // This is supposed to be an IPv6 literal
            if (ip.length() > 2 && ip.charAt(ip.length() - 1) == ']') {
                ip = ip.substring(1, ip.length() - 1);
                ipv6Expected = true;
            } else {
                // This was supposed to be a IPv6 address, but it's not!
                throw new IllegalArgumentException(ip + INVALID_IPV_6_ADDRESS);
            }
        }

        if (Character.digit(ip.charAt(0), 16) != -1 || (ip.charAt(0) == ':')) {
            // see if it is IPv4 address
            byte[] address = IPAddressUtil.textToNumericFormatV4(ip);
            if (address != null) return address;

            // see if it is IPv6 address
            // Check if a numeric or string zone id is present
            address = IPAddressUtil.textToNumericFormatV6(ip);
            if (address != null) return address;

            if (ipv6Expected) {
                throw new IllegalArgumentException(ip + INVALID_IPV_6_ADDRESS);
            } else {
                throw new IllegalArgumentException(ip + INVALID_IP_ADDRESS);
            }
        } else {
            throw new IllegalArgumentException(ip + INVALID_IP_ADDRESS);
        }
    }

<commit_msg>= rename private field: INVALID_IPV_6_ADDRESS -> INVALID_IP_V6_ADDRESS<commit_after>package com.alibaba.dcm.internal;

/**
 * @author <NAME> (<EMAIL>)
 */
final class IpParserUtil {
    private static final String INVALID_IP_V6_ADDRESS = ": invalid IPv6 address";
    private static final String INVALID_IP_ADDRESS = ": invalid IP address";

    /**
     * source code is dug from {@link java.net.InetAddress#getAllByName(java.lang.String, java.net.InetAddress)}
     */
    static byte[] ip2ByteArray(String ip) {
        boolean ipv6Expected = false;
        if (ip.charAt(0) == '[') {
            // This is supposed to be an IPv6 literal
            if (ip.length() > 2 && ip.charAt(ip.length() - 1) == ']') {
                ip = ip.substring(1, ip.length() - 1);
                ipv6Expected = true;
            } else {
                // This was supposed to be a IPv6 address, but it's not!
                throw new IllegalArgumentException(ip + INVALID_IP_V6_ADDRESS);
            }
        }

        if (Character.digit(ip.charAt(0), 16) != -1 || (ip.charAt(0) == ':')) {
            // see if it is IPv4 address
            byte[] address = IPAddressUtil.textToNumericFormatV4(ip);
            if (address != null) return address;

            // see if it is IPv6 address
            // Check if a numeric or string zone id is present
            address = IPAddressUtil.textToNumericFormatV6(ip);
            if (address != null) return address;

            if (ipv6Expected) {
                throw new IllegalArgumentException(ip + INVALID_IP_V6_ADDRESS);
            } else {
                throw new IllegalArgumentException(ip + INVALID_IP_ADDRESS);
            }
        } else {
            throw new IllegalArgumentException(ip + INVALID_IP_ADDRESS);
        }
    }


{'fraction_non_alphanumeric': 0.10928652321630804, 'fraction_numerical': 0.014156285390713477, 'mean_word_length': 1.9814345991561182, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 10, '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': '3632769', 'n_tokens_mistral': 1049, 'n_tokens_neox': 991, 'n_words': 273}