From 7b9da1553bee66328135ab0f13334a6fc4073586 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: Tue, 14 Jan 2025 15:19:48 +0200 Subject: [PATCH] Fix usage of deprecated URL constructor in o.e.jdt.bcoview 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. --- .../eclipse/jdt/bcoview/views/BytecodeReferenceView.java | 4 ++-- .../src/org/eclipse/jdt/bcoview/views/HelpUtils.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/BytecodeReferenceView.java b/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/BytecodeReferenceView.java index f6d0fed66a0..90c80b7669d 100644 --- a/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/BytecodeReferenceView.java +++ b/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/BytecodeReferenceView.java @@ -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 @@ -186,7 +186,7 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) { } private void shouDefaultEmptyPage() { - browser.setUrl(HelpUtils.getHelpIndex().toString()); + browser.setUrl(HelpUtils.SPECS_HTML); } } diff --git a/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/HelpUtils.java b/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/HelpUtils.java index b31c634e8e6..3bc01a10b42 100644 --- a/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/HelpUtils.java +++ b/org.eclipse.jdt.bcoview/src/org/eclipse/jdt/bcoview/views/HelpUtils.java @@ -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 @@ -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; @@ -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; @@ -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; }