From 8c2d31af2c4843bed107170d6b4eebdbb816bff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 25 Apr 2025 21:49:56 +0200 Subject: [PATCH] URL deprecations --- libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java | 3 ++- .../jpexs/decompiler/flash/console/ConsoleUrlResolver.java | 3 ++- src/com/jpexs/decompiler/flash/gui/Main.java | 5 +++-- .../jpexs/decompiler/flash/gui/helpers/CheckResources.java | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index f9a05dcf7..6920be869 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -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()) { diff --git a/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java b/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java index 322cc1cd9..0ecdd0039 100644 --- a/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java +++ b/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java @@ -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) { diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index b94b4b6d4..2944a0142 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -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()) { diff --git a/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java b/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java index 6ec957a2a..de8921c2b 100644 --- a/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java +++ b/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java @@ -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 {