in arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/installer/SdkmanGraalVMInstaller.java [122:142]
private Path download() throws IOException {
final String fname = "graal-" + configuration.getVersion() + "-" + configuration.getPlatform() + "." + configuration.getGav().split(":")[2];
final Path cache = configuration.getWorkdir().resolve(fname);
if (Files.exists(cache)) {
return cache;
}
final URL source = new URL(configuration.getUrl());
final HttpURLConnection connection = HttpURLConnection.class.cast(source.openConnection());
connection.setUseCaches(false);
connection.setInstanceFollowRedirects(true); // sdkman broker redirects on github
try (final InputStream stream = new BufferedInputStream(connection.getInputStream())) {
Files.copy(stream, cache);
} catch (final IOException ioe) {
if (Files.exists(cache)) {
Files.delete(cache);
}
throw ioe;
}
return cache;
}