diff --git a/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/FrameworkTests.java b/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/FrameworkTests.java index 835b16747df..b6bcbfe1e3d 100644 --- a/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/FrameworkTests.java +++ b/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/FrameworkTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 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 @@ -22,6 +22,8 @@ import java.io.File; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import org.eclipse.ant.core.AntCorePlugin; @@ -270,15 +272,16 @@ public void testGetTargets() throws CoreException { } /** - * Tests bug 389564 for a class path entry as a url representing a remote file system location + * Tests bug 389564 for a class path entry as a url representing a remote file + * system location */ @Test - public void testAntClasspathEntryFromUrl() throws MalformedURLException { + public void testAntClasspathEntryFromUrl() throws MalformedURLException, URISyntaxException { AntCorePreferences prefs = AntCorePlugin.getPlugin().getPreferences(); String path = "//hub/home/tom/.eclipse/3.8/configuration/org.eclipse.osgi/bundles/21/2/.cp/lib/remote.jar"; //$NON-NLS-1$ - URL url = new URL(IAntCoreConstants.FILE_PROTOCOL + path); + URL url = new URI(IAntCoreConstants.FILE_PROTOCOL + path).toURL(); IAntClasspathEntry entry = new AntClasspathEntry(url); IAntClasspathEntry[] entries = prefs.getAntHomeClasspathEntries(); diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java index 7d2e3c3325c..5298091ce79 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 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 @@ -292,11 +292,11 @@ private static void reportTimeout() { MultiStatus main = new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, msg, null); ThreadInfo[] threads = ManagementFactory.getThreadMXBean().getThreadInfo( - new long[] { nonUiThread.getId(), Display.getDefault().getThread().getId() }, true, true); + new long[] { nonUiThread.threadId(), Display.getDefault().getThread().threadId() }, true, true); for (ThreadInfo info : threads) { String childMsg; - if (info.getThreadId() == nonUiThread.getId()) { + if (info.getThreadId() == nonUiThread.threadId()) { childMsg = nonUiThread.getName() + " thread probably holding a lock and trying to acquire UI lock"; //$NON-NLS-1$ } else { childMsg = "UI thread waiting on a job or lock."; //$NON-NLS-1$ diff --git a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java index cdfad28d4bd..97d64fc6aca 100644 --- a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java +++ b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2018 IBM Corporation and others. + * Copyright (c) 2005, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -70,7 +70,7 @@ public void testReadUnterminatedLastLine() throws IOException { private BufferedReader getReader(String name) throws IOException { IPath path = IPath.fromOSString("linereaderdata/" + name); - URL url = new URL(CompareTestPlugin.getDefault().getBundle().getEntry("/"), path.toString()); + URL url = CompareTestPlugin.getDefault().getBundle().getEntry("/" + path.toString()); InputStream resourceAsStream = url.openStream(); InputStreamReader reader2 = new InputStreamReader(resourceAsStream); return new BufferedReader(reader2); diff --git a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java index 21881d93c1d..9aa9b29d96a 100644 --- a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java +++ b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 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 @@ -243,7 +243,7 @@ public void testWorkspacePatch_Delete_Reverse() { @Test public void testPatchdataSubfolders() throws IOException, CoreException { - URL patchdataUrl = new URL(PatchUtils.getBundle().getEntry("/"), IPath.fromOSString(PatchUtils.PATCHDATA).toString()); + URL patchdataUrl = PatchUtils.getBundle().getEntry("/" + IPath.fromOSString(PatchUtils.PATCHDATA).toString()); patchdataUrl = FileLocator.resolve(patchdataUrl); Map map = null; diff --git a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java index a1bb26e6e52..aca3f0f28fd 100644 --- a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java +++ b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2023 IBM Corporation and others. + * Copyright (c) 2006, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -571,10 +571,10 @@ public String getType() { public void testToolbarLabelContribution() throws Exception { IPath path = IPath.fromOSString("labelContributionData/" + "file1.java"); - URL url = new URL(CompareTestPlugin.getDefault().getBundle().getEntry("/"), path.toString()); + URL url = CompareTestPlugin.getDefault().getBundle().getEntry("/" + path.toString()); IPath path1= IPath.fromOSString("labelContributionData/" + "file2.java"); - URL url1 = new URL(CompareTestPlugin.getDefault().getBundle().getEntry("/"), path1.toString()); + URL url1 = CompareTestPlugin.getDefault().getBundle().getEntry("/" + path1.toString()); DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.CHANGE, null, new EditableTestElement(url.openStream().readAllBytes()), new EditableTestElement(url1.openStream().readAllBytes())); diff --git a/ua/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipImageURLTest.java b/ua/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipImageURLTest.java index d01ed7b58c1..c215a777395 100644 --- a/ua/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipImageURLTest.java +++ b/ua/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipImageURLTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 Remain Software + * Copyright (c) 2018, 2025 Remain Software * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -17,7 +17,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; -import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import org.eclipse.core.runtime.AssertionFailedException; @@ -34,73 +35,77 @@ public void testTipImage() { @Test public void testTipImage3() { - assertThrows(MalformedURLException.class, () -> new TipImage(new URL("0gl kjfslkfjsl dkfjsldkfjl"))); + assertThrows(URISyntaxException.class, () -> new TipImage(new URI("0gl kjfslkfjsl dkfjsldkfjl").toURL())); } @Test - public void testTipImage2() throws IOException { + public void testTipImage2() throws IOException, URISyntaxException { getTipImage(); } - private TipImage getTipImage() throws IOException { - return new TipImage(new URL(URL)); + private TipImage getTipImage() throws IOException, URISyntaxException { + return new TipImage(new URI(URL).toURL()); } @Test - public void testSetMaxHeight() throws IOException { - String imgAttributes = new TipImage(new URL(URL)).setAspectRatio(2).setMaxHeight(300).getIMGAttributes(200, + public void testSetMaxHeight() throws IOException, URISyntaxException { + String imgAttributes = new TipImage(new URI(URL).toURL()).setAspectRatio(2).setMaxHeight(300) + .getIMGAttributes(200, 200); assertThat(imgAttributes.trim()).isEqualToIgnoringCase("width=\"200\" height=\"100\""); } @Test - public void testSetMaxWidth() throws IOException { - String imgAttributes = new TipImage(new URL(URL)).setAspectRatio(1.6).setMaxWidth(200).getIMGAttributes(400, + public void testSetMaxWidth() throws IOException, URISyntaxException { + String imgAttributes = new TipImage(new URI(URL).toURL()).setAspectRatio(1.6).setMaxWidth(200) + .getIMGAttributes(400, 300); assertThat(imgAttributes.trim()).isEqualToIgnoringCase("width=\"200\" height=\"125\""); } @Test public void testAssertWidth() { - assertThrows(AssertionFailedException.class, () -> new TipImage(new URL(URL)).setAspectRatio(0, 100, false)); + assertThrows(AssertionFailedException.class, + () -> new TipImage(new URI(URL).toURL()).setAspectRatio(0, 100, false)); } @Test public void testAssertHeight() { - assertThrows(AssertionFailedException.class, () -> new TipImage(new URL(URL)).setAspectRatio(1000, 0, false)); + assertThrows(AssertionFailedException.class, + () -> new TipImage(new URI(URL).toURL()).setAspectRatio(1000, 0, false)); } @Test - public void testSetAspectRatioIntIntFalse() throws IOException { + public void testSetAspectRatioIntIntFalse() throws IOException, URISyntaxException { String result = getTipImage().setAspectRatio(200, 50, false).getIMGAttributes(100, 100).trim(); assertThat(result).isEqualToIgnoringCase("width=\"100\" height=\"25\""); } @Test - public void testSetAspectRatioIntIntTrue() throws IOException { + public void testSetAspectRatioIntIntTrue() throws IOException, URISyntaxException { String result = getTipImage().setAspectRatio(400, 300, true).getIMGAttributes(740, 370).trim(); assertThat(result).isEqualToIgnoringCase("width=\"400\" height=\"300\""); } @Test - public void testSetAspectRatioDouble() throws IOException { + public void testSetAspectRatioDouble() throws IOException, URISyntaxException { String result = getTipImage().setAspectRatio(1.5).getIMGAttributes(740, 370).trim(); assertThat(result).isEqualToIgnoringCase("width=\"555\" height=\"370\""); } @Test - public void testGetIMGAttributes() throws IOException { + public void testGetIMGAttributes() throws IOException, URISyntaxException { String result = getTipImage().setAspectRatio(1.5).getIMGAttributes(740, 370).trim(); assertThat(result).isEqualToIgnoringCase("width=\"555\" height=\"370\""); } @Test - public void testSetExtension() throws IOException { + public void testSetExtension() throws IOException, URISyntaxException { assertThat(getTipImage().getBase64Image()).contains("png"); } @Test - public void testSetExtension2() throws IOException { + public void testSetExtension2() throws IOException, URISyntaxException { assertThat(getTipImage().setExtension("bmp").getBase64Image()).contains("bmp"); } }