// try with installed URLStreamHandlers first...
return uri.toURL();
} catch (MalformedURLException e) {
try {
// if that fails then try using the Hadoop protocol handler
return new URL(null, uri.toString(), new HadoopFileSystemURLStreamHandler());
} catch (MalformedURLException _) {
return null; // can't produce a URL
}
}
}