Skip to content

Commit

Permalink
Add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
SiBorea committed Feb 5, 2025
1 parent 2d9b7dc commit cfd9ed4
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,25 @@ public Xml visitDocument(Xml.Document document, ExecutionContext ctx) {
}

// If the dependency is already in compile scope it will be available everywhere, no need to continue
for (ResolvedDependency d : getResolutionResult().getDependencies().get(Scope.Compile)) {
if (hasAcceptableTransitivity(d, acc) &&
groupId.equals(d.getGroupId()) && artifactId.equals(d.getArtifactId())) {
return maven;
Map<Scope, List<ResolvedDependency>> dependencies = getResolutionResult().getDependencies();
if (dependencies.get(Scope.Compile) != null) {
for (ResolvedDependency d : getResolutionResult().getDependencies().get(Scope.Compile)) {
if (hasAcceptableTransitivity(d, acc) &&
groupId.equals(d.getGroupId()) && artifactId.equals(d.getArtifactId())) {
return maven;
}
}
}

String resolvedScope = scope == null ? maybeScope : scope;
Scope resolvedScopeEnum = Scope.fromName(resolvedScope);
if (resolvedScopeEnum == Scope.Provided || resolvedScopeEnum == Scope.Test) {
for (ResolvedDependency d : getResolutionResult().getDependencies().get(resolvedScopeEnum)) {
if (hasAcceptableTransitivity(d, acc) &&
groupId.equals(d.getGroupId()) && artifactId.equals(d.getArtifactId())) {
return maven;
if (dependencies.get(resolvedScopeEnum) != null) {
for (ResolvedDependency d : getResolutionResult().getDependencies().get(resolvedScopeEnum)) {
if (hasAcceptableTransitivity(d, acc) &&
groupId.equals(d.getGroupId()) && artifactId.equals(d.getArtifactId())) {
return maven;
}
}
}
}
Expand Down

0 comments on commit cfd9ed4

Please sign in to comment.