From 8e287dae2d3dc86798ba3be150a4df73c69d8628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Thu, 16 Jan 2025 07:32:47 +0200 Subject: [PATCH] Stop using deprecated URL constructors in o.e.jdt.ui.tests * Let Bundle.getEntry do full resolving * If it's actually used to openConnection go through URI creation. --- .../org/eclipse/jdt/testplugin/JavaTestPlugin.java | 4 ++-- .../org/eclipse/jdt/ui/tests/hover/PackageJavadocTests.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaTestPlugin.java b/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaTestPlugin.java index 4cd0e0296fb..57c22418b9e 100644 --- a/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaTestPlugin.java +++ b/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaTestPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -48,7 +48,7 @@ public static IWorkspace getWorkspace() { public File getFileInPlugin(IPath path) throws CoreException { try { - URL installURL= new URL(getBundle().getEntry("/"), path.toString()); + URL installURL= getBundle().getEntry("/"+ path.toString()); URL localURL= FileLocator.toFileURL(installURL); return new File(localURL.getFile()); } catch (IOException e) { diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/PackageJavadocTests.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/PackageJavadocTests.java index 28b24b804ce..f0db2d29a37 100644 --- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/PackageJavadocTests.java +++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/PackageJavadocTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 IBM Corporation and others. + * Copyright (c) 2013, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -17,7 +17,7 @@ import static org.junit.Assert.assertTrue; import java.io.File; -import java.net.URL; +import java.net.URI; import org.junit.After; import org.junit.Before; @@ -239,7 +239,7 @@ public void testGetPackageAttacheddoc() throws Exception { String connectionTestUrl= "https://docs.oracle.com/"; try { // Trying to connect to the internet. Exception will be thrown if there is no net connection. - new URL(connectionTestUrl).openConnection().connect(); + URI.create(connectionTestUrl).toURL().openConnection().connect(); assertTrue(actualHtmlContent, actualHtmlContent.contains("Provides classes for performing arbitrary-precision integer")); } catch (Exception e) { System.out.println("PackageJavadocTests.testGetPackageAttacheddoc(): no internet connection to access docs at " + connectionTestUrl);