<commit_before>package utils;

import java.util.List;

import org.apache.commons.lang.StringUtils;

public class Url {
    
    /**
     * Create url with given <code>pathSegments</code> and configured scheme, hostname and port.
     * 
     * @param pathSegments List of path segments to construct the path.
     * 
     * @return <code>String</code> containing the created URL
     */
    public static String create(List<String> pathSegments) {
        return create(pathSegments, "localhost");
    }
    
    /**
     * Create url with given <code>pathSegments</code> and configured scheme, hostname and port.
     * 
     * If hostname is not configured, use defaultHostport as hostname and port.
     * 
     * @param pathSegments List of path segments to construct the path.
     * @param defaultHostport
     * 
     * @return <code>String</code> containing the created URL
     * 
     */
    public static String create(List<String> pathSegments, String defaultHostport) {
        return create(pathSegments, defaultHostport, "http");<commit_msg>utils: Better guess for default hostname.<commit_after>package utils;

import java.net.UnknownHostException;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class Url {

    /**
     * Create url with given <code>pathSegments</code> and configured scheme, hostname and port.
     *
     * @param pathSegments List of path segments to construct the path.
     *
     * @return <code>String</code> containing the created URL
     */
    public static String create(List<String> pathSegments) {
        try {
            return create(pathSegments, java.net.InetAddress.getLocalHost().getHostAddress());
        } catch (UnknownHostException e) {
            return create(pathSegments, "localhost");
        }
    }
    
    /**
     * Create url with given <code>pathSegments</code> and configured scheme, hostname and port.
     * 
     * If hostname is not configured, use defaultHostport as hostname and port.
     * 
     * @param pathSegments List of path segments to construct the path.
     * @param defaultHostport
     * 
     * @return <code>String</code> containing the created URL
     * 
     */
    public static String create(List<String> pathSegments, String defaultHostport) {
        return create(pathSegments, defaultHostport, "http");
{'fraction_non_alphanumeric': 0.09110350727117195, 'fraction_numerical': 0.0, 'mean_word_length': 2.8983333333333334, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '7013248', 'n_tokens_mistral': 644, 'n_tokens_neox': 634, 'n_words': 203}