[JENKINS-72028] replace deprecated URL() at core/src/main/java/hudson/ (#8565)

* missing 'alt' attribute added

* missing 'alt' attribute added

* replaced 'new URL' to 'new URI' per Java 11 target codebase

* Revert "replaced 'new URL' to 'new URI' per Java 11 target codebase"

This reverts commit aeef4c1e4b.

* replaced deprecated URL() with URI#.toURL()

* updated code per review

* updated

* updated code

* added back file

* Update core/src/main/java/hudson/cli/InstallPluginCommand.java

Co-authored-by: James Nord <jtnord@users.noreply.github.com>

* Update core/src/main/java/hudson/TcpSlaveAgentListener.java

remove non required as per suggestion

Co-authored-by: James Nord <jtnord@users.noreply.github.com>

* Update core/src/main/java/hudson/model/UpdateSite.java

Co-authored-by: James Nord <jtnord@users.noreply.github.com>

* Update core/src/main/java/hudson/model/UpdateSite.java

* Spotless

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
Co-authored-by: James Nord <jtnord@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2023-10-12 00:45:44 +02:00
1 parent e226ccfa3c
commit dc190bac8a
10 files changed
+111 -52

No files matched your search

+2 -3
View File
@@ -110,7 +110,6 @@ import java.lang.reflect.Type;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@@ -1939,11 +1938,11 @@ public class Functions {
String url = Jenkins.get().getRootUrl();
try {
if (url != null) {
String host = new URL(url).getHost();
String host = new URI(url).toURL().getHost();
if (host != null)
return host;
}
} catch (MalformedURLException e) {
} catch (MalformedURLException | URISyntaxException e) {
// fall back to HTTP request
}
return Stapler.getCurrentRequest().getServerName();