Skip to content

Commit

Permalink
Fix usage of deprecated URL constructor in o.e.jdt.bcoview
Browse files Browse the repository at this point in the history
As the URL is used to fetch remote content and the url is hardcoded it's
safe to go through URI.
Skipped needless String-URL-String conversion for loading web view.
  • Loading branch information
akurtakov committed Jan 14, 2025
1 parent 42dc611 commit 7b9da15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 Eugene Kuleshov and others.
* Copyright (c) 2023, 2025 Eugene Kuleshov 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 @@ -186,7 +186,7 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
}

private void shouDefaultEmptyPage() {
browser.setUrl(HelpUtils.getHelpIndex().toString());
browser.setUrl(HelpUtils.SPECS_HTML);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 Andrey Loskutov and others.
* Copyright (c) 2023, 2025 Andrey Loskutov and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -17,6 +17,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
Expand All @@ -29,7 +30,7 @@
* Fetches latest supported JLS spec and provides help for bytecode opcodes.
*/
public class HelpUtils {
private static final String SPECS_HTML = "https://docs.oracle.com/javase/specs/jvms/se" + AST.getJLSLatest() + "/html/jvms-6.html"; //$NON-NLS-1$ //$NON-NLS-2$
static final String SPECS_HTML = "https://docs.oracle.com/javase/specs/jvms/se" + AST.getJLSLatest() + "/html/jvms-6.html"; //$NON-NLS-1$ //$NON-NLS-2$

private static String fullSpec;

Expand Down Expand Up @@ -91,7 +92,7 @@ private static String getOpcodeName(int opcode) {

private static URL toUrl(String href) {
try {
return new URL(href);
return URI.create(href).toURL();
} catch (MalformedURLException e) {
return null;
}
Expand Down

0 comments on commit 7b9da15

Please sign in to comment.