URL deprecations

This commit is contained in:
Jindra Petřík
2025-04-25 21:49:56 +02:00
parent a25d171280
commit 8c2d31af2c
4 changed files with 10 additions and 6 deletions

View File

@@ -46,6 +46,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.text.MessageFormat;
@@ -1739,7 +1740,7 @@ public class Helper {
public static byte[] downloadUrl(String urlString) throws IOException {
String proxyAddress = Configuration.updateProxyAddress.get();
URL url = new URL(urlString);
URL url = URI.create(urlString).toURL();
URLConnection uc;
if (proxyAddress != null && !proxyAddress.isEmpty()) {

View File

@@ -24,6 +24,7 @@ import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
@@ -105,7 +106,7 @@ public class ConsoleUrlResolver implements UrlResolver {
return null;
}
try {
URL u = new URL(currentUrl);
URL u = URI.create(currentUrl).toURL();
SWF ret = open(u.openStream(), null, currentUrl); //?
return ret;
} catch (Exception ex) {

View File

@@ -104,6 +104,7 @@ import java.io.OutputStream;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
@@ -1276,7 +1277,7 @@ public class Main {
if (selFile == null && (url.startsWith("http://") || url.startsWith("https://"))) {
try {
URL u = new URL(url);
URL u = URI.create(url).toURL();
SWF ret = open(u.openStream(), null, url); //?
loadedStatus.add("YES");
return ret;
@@ -3327,7 +3328,7 @@ public class Main {
private static JsonValue urlGetJson(String getUrl) {
try {
String proxyAddress = Configuration.updateProxyAddress.get();
URL url = new URL(getUrl);
URL url = URI.create(getUrl).toURL();
URLConnection uc;
if (proxyAddress != null && !proxyAddress.isEmpty()) {

View File

@@ -57,6 +57,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.text.ParseException;
@@ -196,8 +197,8 @@ public class CheckResources {
try {
String resPath = "/src" + getResourcePath(clazz, null);
URLConnection uc;
URL latestUrl = new URL(rootUrl + (revision2 == null ? "master" : revision2) + resPath);
URL prevUrl = new URL(rootUrl + revision + resPath);
URL latestUrl = URI.create(rootUrl + (revision2 == null ? "master" : revision2) + resPath).toURL();
URL prevUrl = URI.create(rootUrl + revision + resPath).toURL();
Properties latestProp = new LinkedProperties();
try {