diff options
author | Janak Ramakrishnan <janakr@google.com> | 2016-10-11 00:28:23 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2016-10-11 08:46:30 +0000 |
commit | 5e5aa9d9a4c2eb2b0c185a8108b3bdce0b66d552 (patch) | |
tree | 2d5507713bba9c656f8a53043f8b8aa46fe90ff5 /src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java | |
parent | f4dd283784a0d41ad66fc68c38e38373c3637522 (diff) |
Fix bug(s) with Skylark import cycles: we assumed that a package that failed to load must have failed because of an exception, which is false in the case of cycles;
--
MOS_MIGRATED_REVID=135742248
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java b/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java index 5499189c9b..5e31b91832 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/GraphBackedRecursivePackageProvider.java @@ -85,8 +85,11 @@ public final class GraphBackedRecursivePackageProvider implements RecursivePacka if (graph.exists(pkgKey)) { pkgValue = (PackageValue) graph.getValue(pkgKey); if (pkgValue == null) { - throw (NoSuchPackageException) - Preconditions.checkNotNull(graph.getException(pkgKey), pkgKey); + NoSuchPackageException nspe = (NoSuchPackageException) graph.getException(pkgKey); + if (nspe != null) { + throw nspe; + } + throw new NoSuchPackageException(packageName, "Package depends on a cycle"); } } else { // If the package key does not exist in the graph, then it must not correspond to any package, |