From 02e267a67ca74369bba5300f640265245d1ee300 Mon Sep 17 00:00:00 2001 From: Elsa Zacharia Date: Wed, 30 Apr 2025 16:05:54 +0530 Subject: [PATCH 1/2] java.io.File.toURL() is deprecated and marked for removal. Replace it with file.toURI().toURL(), where toURL() is called on a java.net.URI instance, which is not deprecated and handles encoding correctly. --- .../internal/resources/PlatformURLResourceConnection.java | 2 +- .../update/internal/configurator/PlatformConfiguration.java | 6 +++--- .../org/eclipse/update/internal/configurator/SiteEntry.java | 4 ++-- .../src/org/eclipse/update/internal/configurator/Utils.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PlatformURLResourceConnection.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PlatformURLResourceConnection.java index f54bac54b02..1306c7f8757 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PlatformURLResourceConnection.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PlatformURLResourceConnection.java @@ -104,7 +104,7 @@ public static void startup(IPath root) { if (rootURL != null) return; try { - rootURL = root.toFile().toURL(); + rootURL = root.toFile().toURI().toURL(); } catch (MalformedURLException e) { // should never happen but if it does, the resource URL cannot be supported. return; diff --git a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/PlatformConfiguration.java b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/PlatformConfiguration.java index d3b2567c56e..51494f4e622 100644 --- a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/PlatformConfiguration.java +++ b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/PlatformConfiguration.java @@ -122,7 +122,7 @@ private PlatformConfiguration(Location platformConfigLocation) throws CoreExcept // Retrieve install location with respect to given url if possible try { if (url != null && url.getProtocol().equals("file") && url.getPath().endsWith("configuration/org.eclipse.update/platform.xml")) { - installLocation = IPath.fromOSString(url.getPath()).removeLastSegments(3).toFile().toURL(); + installLocation = IPath.fromOSString(url.getPath()).removeLastSegments(3).toFile().toURI().toURL(); } } catch (Exception e) { // @@ -853,7 +853,7 @@ private Configuration loadConfig(URL url, URL installLocation) throws Exception if (workingDir != null && workingDir.exists()) { File[] backups = workingDir.listFiles((FileFilter) pathname -> pathname.isFile() && pathname.getName().endsWith(".xml")); if (backups != null && backups.length > 0) { - URL backupUrl = backups[backups.length - 1].toURL(); + URL backupUrl = backups[backups.length - 1].toURI().toURL(); config = parser.parse(backupUrl, installLocation); } } @@ -914,7 +914,7 @@ public static URL resolvePlatformURL(URL url, URL base_path_Location) throws IOE if (base_path_Location == null) { url = FileLocator.toFileURL(url); File f = new File(url.getFile()); - url = f.toURL(); + url = f.toURI().toURL(); } else { final String BASE = "platform:/base/"; final String CONFIG = "platform:/config/"; diff --git a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/SiteEntry.java b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/SiteEntry.java index 0c5340260c8..b14c8c9e3d9 100644 --- a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/SiteEntry.java +++ b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/SiteEntry.java @@ -71,7 +71,7 @@ public SiteEntry(URL url, ISitePolicy policy) { if (url.getProtocol().equals("file")) { //$NON-NLS-1$ try { // TODO remove this when platform fixes local file url's - this.url = new File(url.getFile()).toURL(); + this.url = new File(url.getFile()).toURI().toURL(); } catch (MalformedURLException e1) { this.url = url; } @@ -278,7 +278,7 @@ private void detectFeatures() { if (featureXML.lastModified() <= featuresChangeStamp && dir.lastModified() <= featuresChangeStamp) continue; - URL featureURL = featureXML.toURL(); + URL featureURL = featureXML.toURI().toURL(); FeatureEntry featureEntry = featureParser.parse(featureURL); if (featureEntry != null) addFeatureEntry(featureEntry); diff --git a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java index 20c96811305..e8e5c9f3ed0 100644 --- a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java +++ b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java @@ -411,7 +411,7 @@ public static URL makeAbsolute(URL base, URL relativeLocation) { try { IPath absolutePath = IPath.fromOSString(base.getPath()).append(relativeLocation.getPath()); // File.toURL() is the best way to create a file: URL - return absolutePath.toFile().toURL(); + return absolutePath.toFile().toURI().toURL(); } catch (MalformedURLException e) { // cannot happen since we are building from two existing valid URLs Utils.log(e.getLocalizedMessage()); @@ -488,7 +488,7 @@ public static String canonicalizeURL(String url) { char[] chars = path.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); path = new String(chars); - return new File(path).toURL().toExternalForm(); + return new File(path).toURI().toURL().toExternalForm(); } } catch (MalformedURLException e) { // default to original url From 85b56c2f56b8b59e78b5f494472bcd7ebaf07cc4 Mon Sep 17 00:00:00 2001 From: Eclipse Platform Bot Date: Wed, 30 Apr 2025 10:44:45 +0000 Subject: [PATCH 2/2] Version bump(s) for 4.36 stream --- update/org.eclipse.update.configurator/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF b/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF index 5f045c73188..f1a5deb0340 100644 --- a/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF +++ b/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.update.configurator; singleton:=true -Bundle-Version: 3.5.600.qualifier +Bundle-Version: 3.5.700.qualifier Bundle-Activator: org.eclipse.update.internal.configurator.ConfigurationActivator Bundle-Vendor: %providerName Bundle-Localization: plugin