You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "yeikel (via GitHub)" <gi...@apache.org> on 2023/03/21 03:09:02 UTC

[GitHub] [maven] yeikel commented on a diff in pull request #1065: [MNG-7743] Make the build work on JDK 20

yeikel commented on code in PR #1065:
URL: https://github.com/apache/maven/pull/1065#discussion_r1142851675


##########
maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java:
##########
@@ -49,10 +49,18 @@ public class TestRepositoryConnector implements RepositoryConnector {
 
     public TestRepositoryConnector(RemoteRepository repository) {
         this.repository = repository;
-        try {
-            basedir = FileUtils.toFile(new URL(repository.getUrl()));
-        } catch (MalformedURLException e) {
-            throw new IllegalStateException(e);
+        String repositoryUrl = repository.getUrl();
+        if (repositoryUrl.contains("${")) {
+            // the repository url contains unresolved properties and getting the basedir is not possible
+            // in JDK 20+ 'new URL(string)' will fail if the string contains a curly brace
+            this.basedir = null;
+        } else {
+            try {
+                basedir = FileUtils.toFile(new URL(repositoryUrl));
+                System.out.println(basedir);
+            } catch (MalformedURLException e) {
+                throw new IllegalStateException(e);
+            }

Review Comment:
   ```suggestion
           } else {
               try {
                   basedir = FileUtils.toFile(new URL(repositoryUrl));
               } catch (MalformedURLException e) {
                   throw new IllegalStateException(e);
               }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org