public URL getResource()

in src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java [270:303]


    public URL getResource(String path) {
        if (path.startsWith(CONFIG_PATH_PREFIX)) {
            final File configFile = getConfigFile(path);
            if (configFile.exists()) {
                try {
                    return configFile.toURI().toURL();
                } catch (MalformedURLException e) {
                    // ignore this one
                }
            }
        }

        File resourceFile = new File(resourceProviderRoot, path);
        if (resourceFile.exists()) {
            try {
                return resourceFile.toURI().toURL();
            } catch (MalformedURLException e) {
                getLog().error("Unable to create URL for file", e);
                return null;
            }
        } else {
            URL fromClasspath = getClass().getResource("/" + path);
            if (fromClasspath != null) {
                return fromClasspath;
            }

            try {
                return new URL(path);
            } catch (MalformedURLException e) {
                return null;
            }
        }

    }