Skip to content

Commit

Permalink
[MRESOLVER-376] Alt fix (#311)
Browse files Browse the repository at this point in the history
Solve the mixup of Artifact used as key, as in case of relocation
A1 -> A2, when A1 descriptor is read, the result will have
A2 artifact set.

So, in code, we must go for "originally asked" A1 artifact, as
in case of relocation, the descriptor will hold A1 relocation
target, that is A2, causing endless loop.

---

https://issues.apache.org/jira/browse/MRESOLVER-376
  • Loading branch information
cstamas authored Jul 19, 2023
1 parent 1a3e9fd commit 6efe87a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,14 @@ static class DescriptorResolutionResult {

DescriptorResolutionResult(
VersionRangeResult rangeResult, Version version, ArtifactDescriptorResult descriptor) {
this(descriptor.getArtifact(), rangeResult);
// NOTE: In case of A1 -> A2 relocation this happens:
// ArtifactDescriptorResult read by ArtifactDescriptorResultReader for A1
// will return instance that will have artifact = A2 (as RelocatedArtifact).
// So to properly "key" this instance, we need to use "originally requested" A1 instead!
// In short:
// ArtifactDescriptorRequest.artifact != ArtifactDescriptorResult.artifact WHEN relocation in play
// otherwise (no relocation), they are EQUAL.
this(descriptor.getRequest().getArtifact(), rangeResult);
this.descriptors.put(version, descriptor);
}

Expand Down

0 comments on commit 6efe87a

Please sign in to comment.