Skip to content

Commit

Permalink
Re-add null check for exclude rule (#1883)
Browse files Browse the repository at this point in the history
Re-add null check for exclude rule
  • Loading branch information
fawind authored Aug 18, 2021
1 parent c9af981 commit 5fb72f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1883.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Re-add null check for exclude rule
links:
- https://github.com/palantir/gradle-baseline/pull/1883
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableSet;
import com.palantir.baseline.tasks.CheckImplicitDependenciesParentTask;
import com.palantir.baseline.tasks.CheckImplicitDependenciesTask;
Expand Down Expand Up @@ -231,10 +232,15 @@ private static String getCompileConfigurationName(SourceSet sourceSet) {
}

private static Map<String, String> excludeRuleAsMap(ExcludeRule rule) {
return ImmutableMap.<String, String>builder()
.put("group", rule.getGroup())
.put("module", rule.getModule())
.build();
// Both 'ExcludeRule#getGroup' and 'ExcludeRule#getModule' can return null.
Builder<String, String> excludeRule = ImmutableMap.builder();
if (rule.getGroup() != null) {
excludeRule.put("group", rule.getGroup());
}
if (rule.getModule() != null) {
excludeRule.put("module", rule.getModule());
}
return excludeRule.build();
}

/** Given a {@code com/palantir/product/Foo.class} file, what other classes does it import/reference. */
Expand Down

0 comments on commit 5fb72f3

Please sign in to comment.