<commit_before>package com.heroku.sdk.deploy.utils;

import java.util.Arrays;
import java.util.List;

/**
 * Resolves group id and download URLs for webapp-runner. At one point its group id changed, creating the need
 * to discern which version uses which group id and download URL.
 */
public class WebappRunnerResolver {

    public static String getGroupIdForVersion(String version) {
        return isLegacyVersion(version) ? "com.github.jsimone" : "com.heroku";
    }

    public static String getUrlForVersion(String version) {
        String pattern = isLegacyVersion(version)
                ? "http://central.maven.org/maven2/com/github/jsimone/webapp-runner/%s/webapp-runner-%s.jar"
                : "http://central.maven.org/maven2/com/heroku/webapp-runner/%s/webapp-runner-%s.jar";

        return String.format(pattern, version, version);
    }

    private static boolean isLegacyVersion(String version) {
        return knownLegacyVersions.contains(version);
    }

    // Known versions that use the legacy group id "com.github.jsimone". Since there are only a handful of
    // legacy versions around, maintaining a static list is more robust than using a more complex version matching
    // mechanism.
    private static final List<String> knownLegacyVersions = Arrays.asList(
            "9.0.27.1",
            "9.0.27.0",
            "9.0.24.1",
            "9.0.24.0",
            "9.0.22.0",
            "9.0.20.1",
            "9.0.20.0",
            "9.0.19.1",
            "9.0.19.0",
            "9.0.17.0",
            "9.0.16.0",
            "9.0.14.0",
            "9.0.13.0",
            "9.0.11.0",<commit_msg>Change webapp-runner download URLs to https<commit_after>package com.heroku.sdk.deploy.utils;

import java.util.Arrays;
import java.util.List;

/**
 * Resolves group id and download URLs for webapp-runner. At one point its group id changed, creating the need
 * to discern which version uses which group id and download URL.
 */
public class WebappRunnerResolver {

    public static String getGroupIdForVersion(String version) {
        return isLegacyVersion(version) ? "com.github.jsimone" : "com.heroku";
    }

    public static String getUrlForVersion(String version) {
        String pattern = isLegacyVersion(version)
                ? "https://repo1.maven.org/maven2/com/github/jsimone/webapp-runner/%s/webapp-runner-%s.jar"
                : "https://repo1.maven.org/maven2/com/heroku/webapp-runner/%s/webapp-runner-%s.jar";

        return String.format(pattern, version, version);
    }

    private static boolean isLegacyVersion(String version) {
        return knownLegacyVersions.contains(version);
    }

    // Known versions that use the legacy group id "com.github.jsimone". Since there are only a handful of
    // legacy versions around, maintaining a static list is more robust than using a more complex version matching
    // mechanism.
    private static final List<String> knownLegacyVersions = Arrays.asList(
            "9.0.27.1",
            "9.0.27.0",
            "9.0.24.1",
            "9.0.24.0",
            "9.0.22.0",
            "9.0.20.1",
            "9.0.20.0",
            "9.0.19.1",
            "9.0.19.0",
            "9.0.17.0",
            "9.0.16.0",
            "9.0.14.0",
            "9.0.13.0",
            "9.0.11.0",
{'fraction_non_alphanumeric': 0.12515078407720145, 'fraction_numerical': 0.04402895054282268, 'mean_word_length': 2.1500474833808165, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 28, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3231890', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1032, 'n_words': 248}