/** * Make sure the given location is an URL. E.g. adds "file:" if necessary. * * @param aLocation * the location. * @return an URL. * @throws MalformedURLException * if the location cannot be converted to a valid URL. */ protected String locationToUrl(String aLocation) throws MalformedURLException { String location = aLocation; if (isUnmarkedFileLocation(aLocation)) { location = new File(location).toURI().toURL().toString(); } else if (location.startsWith(JAR_PREFIX) && !location.contains("!")) { // If we write something like "jar:file:/my/archive.zip", append the required "!" location += "!"; } return location; }
/** * Make sure the given location is an URL. E.g. adds "file:" if necessary. * * @param aLocation * the location. * @return an URL. * @throws MalformedURLException * if the location cannot be converted to a valid URL. */ protected String locationToUrl(String aLocation) throws MalformedURLException { String location = aLocation; if (isUnmarkedFileLocation(aLocation)) { location = new File(location).toURI().toURL().toString(); } else if (location.startsWith(JAR_PREFIX) && !location.contains("!")) { // If we write something like "jar:file:/my/archive.zip", append the required "!" location += "!"; } return location; }