Replace deprecated URL constructor
See https://inside.java/2023/02/15/quality-heads-up/
Change-Id: I520a4baeb1442a1a357a88f1755447cd285a77d8
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
index cb41f9b..9149a13 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
@@ -30,7 +30,7 @@
import com.google.inject.Provider;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -60,7 +60,7 @@
&& (sshAddr.startsWith("*:") || "".equals(sshAddr))
&& urlProvider != null) {
try {
- sshAddr = new URL(urlProvider.get()).getHost() + sshAddr.substring(1);
+ sshAddr = URI.create(urlProvider.get()).toURL().getHost() + sshAddr.substring(1);
} catch (MalformedURLException e) {
// ignore, then this scheme will be disabled
}
@@ -92,7 +92,8 @@
String sshdPrimaryAddress = config.getString("sshdAdvertisedPrimaryAddress");
if (sshdPrimaryAddress != null && sshdPrimaryAddress.startsWith("*:") && urlProvider != null) {
try {
- sshdPrimaryAddress = new URL(urlProvider.get()).getHost() + sshdPrimaryAddress.substring(1);
+ sshdPrimaryAddress =
+ URI.create(urlProvider.get()).toURL().getHost() + sshdPrimaryAddress.substring(1);
} catch (MalformedURLException e) {
// ignore, then this scheme will be disabled
}