Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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$
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<String, PatchTestConfiguration> map = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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");
}
}
Loading