aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2015-06-02 18:15:11 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-06-03 13:48:33 +0000
commit2cd174b87a8eb5318b9768eb84fde5c6eec731a8 (patch)
tree2d70fa3cc9c0e42929117689226f5b308b2b42d9 /src/main/java/com/google/devtools/build/lib
parentde735c023ca880dd4b2d71bed731ea2e780f6a4b (diff)
Fix issue where MavenDownloader was using empty defaults for repository
AttributeMap#has() checks that an attribute exists for a rule but not if values are actually defined. Check if specified repository values are non-empty before using. -- MOS_MIGRATED_REVID=95025038
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java
index 4c1e95cf8c..a04f86a123 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenJarFunction.java
@@ -160,10 +160,12 @@ public class MavenJarFunction extends HttpArchiveFunction {
} else {
this.sha1 = null;
}
- if (mapper.has("repository", Type.STRING)) {
+ if (mapper.has("repository", Type.STRING)
+ && !mapper.get("repository", Type.STRING).isEmpty()) {
this.repositories = ImmutableList.of(new RemoteRepository.Builder(
"user-defined repository", "default", mapper.get("repository", Type.STRING)).build());
- } else if (mapper.has("repositories", Type.STRING_LIST)) {
+ } else if (mapper.has("repositories", Type.STRING_LIST)
+ && !mapper.get("repositories", Type.STRING_LIST).isEmpty()) {
// TODO(kchodorow): remove after 9/15, uses deprecated list of repositories attribute.
this.repositories = Lists.newArrayList();
for (String repositoryUrl : mapper.get("repositories", Type.STRING_LIST)) {