private URL checkFeatureFile()

in src/main/java/org/apache/sling/kickstart/app/KickstartStarter.java [249:270]


    private URL checkFeatureFile(String featureFile) {
        URL answer = null;
        if(featureFile != null && !featureFile.isEmpty()) {
            try {
                URL check = new URL(featureFile);
                check.toURI();
                answer = check;
            } catch (MalformedURLException | URISyntaxException e) {
                // Try it as a file
                File check = new File(featureFile);
                if (!check.exists() || !check.canRead()) {
                    throw new RuntimeException("Given Feature File is not a valid URL or File: '" + featureFile + "'", e);
                }
                try {
                    answer = check.toURI().toURL();
                } catch (MalformedURLException ex) {
                    throw new RuntimeException("Given Feature File cannot be converted to an URL: '" + featureFile + "'", e);
                }
            }
        }
        return answer;
    }