in src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java [233:265]
public URL locateFromURL(final String basePath, final String fileName) {
final String fileScheme = UriParser.extractScheme(fileName);
// Use DefaultFileSystem if basePath and fileName don't have a scheme.
if ((basePath == null || UriParser.extractScheme(basePath) == null) && fileScheme == null) {
return super.locateFromURL(basePath, fileName);
}
try {
final FileObject file;
// Only use the base path if the file name doesn't have a scheme.
if (basePath != null && fileScheme == null) {
final String scheme = UriParser.extractScheme(basePath);
final FileSystemOptions opts = getOptions(scheme);
FileObject base = getManager().resolveFile(basePath, opts);
if (base.isFile()) {
base = base.getParent();
}
file = getManager().resolveFile(base, fileName);
} else {
final FileSystemOptions opts = getOptions(fileScheme);
file = getManager().resolveFile(fileName, opts);
}
if (!file.exists()) {
return null;
}
final FileName path = file.getName();
final URLStreamHandler handler = new VFSURLStreamHandler();
return new URL(null, path.getURI(), handler);
} catch (final FileSystemException | MalformedURLException fse) {
return null;
}
}