Skip to content
Draft
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
Expand Up @@ -16,6 +16,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.text.MessageFormat;
import java.util.HashMap;
Expand Down Expand Up @@ -390,7 +391,8 @@ private static Image getImageFromPlugin(Bundle bundle, String iconPath) {
InputStream is = null;
try {
URL installUrl = bundle.getEntry("/");
URL url = new URL(installUrl, iconPath);
URI uri = installUrl.toURI().resolve(iconPath);
URL url = uri.toURL();
is = url.openConnection().getInputStream();
ImageData source = new ImageData(is);
ImageData mask = source.getTransparencyMask();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;

import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
Expand Down Expand Up @@ -423,8 +424,8 @@ public void dragStart(org.eclipse.swt.dnd.DragSourceEvent event) {
dragDataHTML = "<b>"+dragDataText+"</b>";
dragDataURL = "http://" + dragDataText.replace(' ', '.');
try {
new URL(dragDataURL);
} catch (MalformedURLException e) {
new URI(dragDataURL).toURL();
} catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) {
dragDataURL = null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;

import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
Expand Down Expand Up @@ -879,7 +880,7 @@ void menuOpenURL() {
imageCanvas.setCursor(waitCursor);
ImageLoader oldLoader = loader;
try {
URL url = new URL(urlname);
URL url = new URI(urlname).toURL();
try (InputStream stream = url.openStream()) {
loader = new ImageLoader();
if (incremental) {
Expand Down Expand Up @@ -1221,7 +1222,7 @@ void menuReopen() {
loader = new ImageLoader();
ImageData[] newImageData;
if (fileName == null) {
URL url = new URL(currentName);
URL url = new URI(currentName).toURL();
try (InputStream stream = url.openStream()) {
long startTime = System.currentTimeMillis();
newImageData = loader.load(stream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ public void changed(LocationEvent event) {

browser.addAuthenticationListener(event -> {
try {
URL url = new URL(event.location);
if (url.getHost().equals(KNOWN_HOST)) {
URI uri = new URI(event.location);
if (uri.getHost().equals(KNOWN_HOST)) {
event.user = KNOWN_USER;
event.password = KNOWN_PASSWORD;
} else {
/* do nothing, let default prompter run */
}
} catch (MalformedURLException e) {
} catch (URISyntaxException e) {
/* should not happen, let default prompter run */
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public static void main(String[] args) {
*/
private static boolean canRunCommand(String command) {
try {
final Process p = Runtime.getRuntime().exec(command);
final Process p = Runtime.getRuntime().exec(new String[] {command});
p.waitFor(150, TimeUnit.MILLISECONDS);
if (p.isAlive()) {
p.destroy();
Expand Down Expand Up @@ -1042,7 +1042,7 @@ public void stopSnippets() {
if (!launchedSnippets.isEmpty()) {
System.err.println("Some Snippets are still running:");
for (Thread t : launchedSnippets) {
System.err.println(" " + t.getName() + " (ThreadId: " + t.getId() + ")");
System.err.println(" " + t.getName() + " (ThreadId: " + t.threadId() + ")");
final Display d = Display.findDisplay(t);
if (d != null && !d.isDisposed()) {
d.syncExec(d::dispose);
Expand Down
Loading