Skip to content

Commit

Permalink
[MRESOLVER-316] DF Collector may enter endless loop (#244)
Browse files Browse the repository at this point in the history
When resolving artifact from issue, the DF collector enters endless loop. But the loop is NOT in collecting, it happens when DF detect unsolvable problem, and tries to report it. To report it, it needs to visit the graph of collected nodes, but that graph contains loops (and it is expected).

But, the problem is that PathRecordingDependencyVisitor used to collect paths chokes on loops.

Fix: just like in RepositorySystem#resolveDependencies, wrap up the graph visitor into TreeDependencyVisitor, that creates tree-like (loopless, tree by def) "view" of graph.

With this fix, DF immediately detects that artifact in issue is unresolvable (just like BF does), as it contains unsolvable (not intersecting) ranges.

---

https://issues.apache.org/jira/browse/MRESOLVER-316
  • Loading branch information
cstamas authored Feb 15, 2023
1 parent f7a542b commit 88dab9f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.eclipse.aether.util.graph.transformer.ConflictResolver.ConflictItem;
import org.eclipse.aether.util.graph.transformer.ConflictResolver.VersionSelector;
import org.eclipse.aether.util.graph.visitor.PathRecordingDependencyVisitor;
import org.eclipse.aether.util.graph.visitor.TreeDependencyVisitor;
import org.eclipse.aether.version.Version;
import org.eclipse.aether.version.VersionConstraint;

Expand Down Expand Up @@ -155,7 +156,7 @@ private UnsolvableVersionConflictException newFailure( final ConflictContext con
return context.isIncluded( node );
};
PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( filter );
context.getRoot().accept( visitor );
context.getRoot().accept( new TreeDependencyVisitor( visitor ) );
return new UnsolvableVersionConflictException( visitor.getPaths() );
}

Expand Down

0 comments on commit 88dab9f

Please sign in to comment.