diff options
author | Michajlo Matijkiw <michajlo@google.com> | 2015-06-02 18:15:11 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-06-03 13:48:33 +0000 |
commit | 2cd174b87a8eb5318b9768eb84fde5c6eec731a8 (patch) | |
tree | 2d70fa3cc9c0e42929117689226f5b308b2b42d9 /src/main/java/com/google/devtools/build/lib | |
parent | de735c023ca880dd4b2d71bed731ea2e780f6a4b (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.java | 6 |
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)) { |