This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new c373d2799a0 Update creation of URL to avoid deprecation message (#2851)
c373d2799a0 is described below

commit c373d2799a01b26e2645b61f4d30e8d5e53976c9
Author: Eric Pugh <[email protected]>
AuthorDate: Fri Nov 8 07:45:11 2024 -0500

    Update creation of URL to avoid deprecation message (#2851)
---
 .../java/org/apache/lucene/gradle/WrapperDownloader.java     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java
 
b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java
index 88d91028552..adb8f3eaf07 100644
--- 
a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java
+++ 
b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java
@@ -22,7 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
-import java.net.URL;
+import java.net.URI;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -54,7 +54,7 @@ public class WrapperDownloader {
   }
 
   public static void checkVersion() {
-    int major = Runtime.getRuntime().version().feature();
+    int major = Runtime.version().feature();
     if (major < 21 || major > 23) {
       throw new IllegalStateException(
           "java version must be between 21 and 23, your version: " + major);
@@ -89,12 +89,12 @@ public class WrapperDownloader {
       }
     }
 
-    URL url =
-        new URL(
+    URI uri =
+        URI.create(
             "https://raw.githubusercontent.com/gradle/gradle/v";
                 + wrapperVersion
                 + "/gradle/wrapper/gradle-wrapper.jar");
-    System.err.println("Downloading gradle-wrapper.jar from " + url);
+    System.err.println("Downloading gradle-wrapper.jar from " + uri);
 
     // Zero-copy save the jar to a temp file
     Path temp = Files.createTempFile(destination.getParent(), 
".gradle-wrapper", ".tmp");
@@ -103,7 +103,7 @@ public class WrapperDownloader {
       int retryDelay = 30;
       HttpURLConnection connection;
       while (true) {
-        connection = (HttpURLConnection) url.openConnection();
+        connection = (HttpURLConnection) uri.toURL().openConnection();
         try {
           connection.connect();
         } catch (IOException e) {

Reply via email to