[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

+8 -1
View File
@@ -83,6 +83,7 @@ import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
@@ -3338,7 +3339,13 @@ public final class FilePath implements SerializableOnlyOverRemoting {
@Restricted(NoExternalUse.class)
static class UrlFactory {
public URL newURL(String location) throws MalformedURLException {
return new URL(location);
try {
return new URI(location).toURL();
} catch (URISyntaxException e) {
MalformedURLException mex = new MalformedURLException(e.getMessage());
mex.initCause(e);
throw mex;
}
}
}