Skip to content

Commit

Permalink
Stop using deprecated URL constructors
Browse files Browse the repository at this point in the history
Changes tests only.
  • Loading branch information
akurtakov committed Dec 19, 2024
1 parent 0d51f20 commit 1d50889
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
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

0 comments on commit 1d50889

Please sign in to comment.