Skip to content

Commit

Permalink
Fix comparison of repo URI
Browse files Browse the repository at this point in the history
  • Loading branch information
fabapp2 committed Nov 7, 2023
1 parent 1a5b999 commit 2ff68db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class MavenSettingsInitializer {
* @deprecated initialization in ExecutionoContext is done in ProjectParser
*/
public void initializeMavenSettings() {
String repo = "file://" + Path.of(System.getProperty("user.home")).resolve(".m2/repository") + "/";
String repo = "file:" + Path.of(System.getProperty("user.home")).resolve(".m2/repository") + "/";
MavenRepository mavenRepository = new MavenRepository("local", repo, "true", "true", true, null, null, false);
MavenSettings mavenSettings = new MavenSettings(repo, mavenRepository, null, null, null, null);
// Read .m2/settings.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.sbm.parsers.RewriteProjectParsingResult;

import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.util.*;
import java.util.function.BiConsumer;
Expand Down Expand Up @@ -287,6 +288,17 @@ private void compareMavenResolutionResultMarker(SoftAssertions softAssertions, M
f1.getHost().equals(f2.getHost()) &&
f1.getPath().equals(f2.getPath()) &&
f1.getFragment().equals(f2.getFragment());
} else if(fi1 instanceof String) {
try {
URI f1 = new URI((String) fi1);
URI f2 = new URI((String) fi2);
return equals ? true : f1.getScheme().equals(f2.getScheme()) &&
f1.getHost() == null ? (f2.getHost() == null ? true : false) : f1.getHost().equals(f2.getHost()) &&
f1.getPath().equals(f2.getPath()) &&
f1.getFragment().equals(f2.getFragment());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} else {
return false;
}
Expand Down

0 comments on commit 2ff68db

Please sign in to comment.