Skip to content

Commit

Permalink
Update WrapperDownloader to accept java 22 and correct deprecated new…
Browse files Browse the repository at this point in the history
… URL API #13458
  • Loading branch information
dweiss committed Jun 6, 2024
1 parent 586d489 commit 7cc07a7
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URI;
import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
Expand Down Expand Up @@ -60,8 +61,8 @@ public static void main(String[] args) {

public static void checkVersion() {
int major = Runtime.getRuntime().version().feature();
if (major < 11 || major > 21) {
throw new IllegalStateException("java version must be between 17 and 21, your version: " + major);
if (major < 11 || major > 22) {
throw new IllegalStateException("java version must be between 17 and 22, your version: " + major);
}
}

Expand Down Expand Up @@ -91,7 +92,7 @@ public void run(Path destination) throws IOException, NoSuchAlgorithmException {
}
}

URL url = new URL("https://raw.githubusercontent.com/gradle/gradle/v" + wrapperVersion + "/gradle/wrapper/gradle-wrapper.jar");
URL url = URI.create("https://raw.githubusercontent.com/gradle/gradle/v" + wrapperVersion + "/gradle/wrapper/gradle-wrapper.jar").toURL();
System.err.println("Downloading gradle-wrapper.jar from " + url);

// Zero-copy save the jar to a temp file
Expand Down

0 comments on commit 7cc07a7

Please sign in to comment.