This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git
The following commit(s) were added to refs/heads/master by this push: new ca5057c [MWRAPPER-124] Avoid Java 21's deprecation of the URL constructors ca5057c is described below commit ca5057c8ece887255b7e363f9a201009307ce2ce Author: Russell Howe <rh...@siksai.co.uk> AuthorDate: Sat Feb 17 09:53:47 2024 +0000 [MWRAPPER-124] Avoid Java 21's deprecation of the URL constructors new URL(String) was [deprecated in Java 21](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/net/URL.html#constructor-deprecation) The Maven Wrapper docs say that Java 7+ is supported, so we can switch to using URI.create(String).toURL() instead, which is supported in Java 7 --- .../src/resources/mvn/wrapper/MavenWrapperDownloader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maven-wrapper-distribution/src/resources/mvn/wrapper/MavenWrapperDownloader.java b/maven-wrapper-distribution/src/resources/mvn/wrapper/MavenWrapperDownloader.java index b974f57..a21f42b 100644 --- a/maven-wrapper-distribution/src/resources/mvn/wrapper/MavenWrapperDownloader.java +++ b/maven-wrapper-distribution/src/resources/mvn/wrapper/MavenWrapperDownloader.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.Authenticator; import java.net.PasswordAuthentication; +import java.net.URI; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; @@ -46,7 +47,7 @@ public final class MavenWrapperDownloader try { log( " - Downloader started" ); - final URL wrapperUrl = new URL( args[0] ); + final URL wrapperUrl = URI.create( args[0] ).toURL(); final String jarPath = args[1].replace( "..", "" ); // Sanitize path final Path wrapperJarPath = Paths.get( jarPath ).toAbsolutePath().normalize(); downloadFileFromURL( wrapperUrl, wrapperJarPath );