Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using deprecated URL constructors #1529

Closed
wants to merge 1 commit into from
Closed
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) 2011, 2021 Sonatype, Inc. and others.
* Copyright (c) 2011, 2024 Sonatype, Inc. 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 @@ -27,7 +27,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
Expand Down Expand Up @@ -401,15 +402,15 @@ private void mockTPWithRunningPlatformAndBundles(
}

private Properties createDevEntryProperties(List<IPluginModelBase> launchedBundles)
throws IOException, CoreException {
throws IOException, CoreException, URISyntaxException {
File devPropertiesFile = tempFolder.newFile("dev.properties").getCanonicalFile();
Map<String, List<IPluginModelBase>> bundlesMap = Map.of(HOST_BUNDLE_ID, launchedBundles);
String devPropertiesURL = ClasspathHelper.getDevEntriesProperties(devPropertiesFile.getPath(), bundlesMap);
return loadProperties(devPropertiesURL);
}

private static Properties loadProperties(String devPropertiesURL) throws IOException {
File propertiesFile = new File(new URL(devPropertiesURL).getPath());
private static Properties loadProperties(String devPropertiesURL) throws IOException, URISyntaxException {
File propertiesFile = new File(new URI(devPropertiesURL).getPath());
Properties devProperties = new Properties();
try (InputStream stream = new FileInputStream(propertiesFile)) {
devProperties.load(stream);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 Hannes Wellmann and others.
* Copyright (c) 2021, 2024 Hannes Wellmann 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 @@ -27,9 +27,8 @@

import java.io.File;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -1052,7 +1051,7 @@ private static ILaunchConfigurationWorkingCopy createPluginLaunchConfig(String n
private static final Pattern WHITESPACE = Pattern.compile("\\s+");

private Path getConfigurationFolder(ILaunchConfigurationWorkingCopy launchConfig)
throws CoreException, MalformedURLException {
throws CoreException, URISyntaxException {
ILaunch launch = new Launch(launchConfig, ILaunchManager.RUN_MODE, null);
var config = new EclipseApplicationLaunchConfiguration();
String commandLine = config.showCommandLine(launchConfig, ILaunchManager.RUN_MODE, launch, null);
Expand All @@ -1062,7 +1061,7 @@ private Path getConfigurationFolder(ILaunchConfigurationWorkingCopy launchConfig
try {
return Path.of(URI.create(configURL));
} catch (IllegalArgumentException e) {
return Path.of(new URL(configURL).getPath());
return Path.of(new URI(configURL).getPath());
}
}

Expand Down
Loading