in core/src/main/java/org/apache/calcite/avatica/util/Sources.java [127:152]
private static URL fileToUrl(File file) {
String filePath = file.getPath();
if (!file.isAbsolute()) {
// convert relative file paths
filePath = filePath.replace(File.separatorChar, '/');
if (file.isDirectory() && !filePath.endsWith("/")) {
filePath += "/";
}
try {
return new URI("file", filePath, null).toURL();
} catch (MalformedURLException | URISyntaxException e) {
throw new IllegalArgumentException("Unable to create URL for file " + filePath, e);
}
}
URI uri = null;
try {
// convert absolute file paths
uri = file.toURI();
return uri.toURL();
} catch (SecurityException e) {
throw new IllegalArgumentException("No access to the underlying file " + filePath, e);
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Unable to convert URI " + uri + " to URL", e);
}
}