add return statements to future after .complete()
This commit is contained in:
parent
c4901e80ce
commit
61830e93f5
@ -107,6 +107,7 @@ public class ArchDistribution implements Distribution {
|
|||||||
// unknown package, probably an abstract dependency
|
// unknown package, probably an abstract dependency
|
||||||
logger.fine("Completing callback INVALID for package %s (depth=%s)".formatted(packageName, depth));
|
logger.fine("Completing callback INVALID for package %s (depth=%s)".formatted(packageName, depth));
|
||||||
futurePackage.complete(null);
|
futurePackage.complete(null);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
JSONObject resultJson = json.getJSONArray("results").getJSONObject(0);
|
JSONObject resultJson = json.getJSONArray("results").getJSONObject(0);
|
||||||
|
|
||||||
@ -117,10 +118,11 @@ public class ArchDistribution implements Distribution {
|
|||||||
description = resultJson.getString("pkgdesc");
|
description = resultJson.getString("pkgdesc");
|
||||||
|
|
||||||
// if we're at the maximum depth, return the package without its dependencies
|
// if we're at the maximum depth, return the package without its dependencies
|
||||||
if(depth==0){
|
if(depth==0) {
|
||||||
logger.fine("Completing callback NODEP for package %s (depth=%s)".formatted(packageName, depth));
|
logger.fine("Completing callback NODEP for package %s (depth=%s)".formatted(packageName, depth));
|
||||||
futurePackage.complete(new Package(name, version, repo, description, Collections.emptyList()));
|
futurePackage.complete(new Package(name, version, repo, description, Collections.emptyList()));
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
// iterate for every package in the list
|
// iterate for every package in the list
|
||||||
List<CompletableFuture<Package>> futureDeps = new ArrayList<>();
|
List<CompletableFuture<Package>> futureDeps = new ArrayList<>();
|
||||||
for (Object depPackageNameObj : resultJson.getJSONArray("depends")) {
|
for (Object depPackageNameObj : resultJson.getJSONArray("depends")) {
|
||||||
@ -140,7 +142,6 @@ public class ArchDistribution implements Distribution {
|
|||||||
// TODO this doesn't seem clean
|
// TODO this doesn't seem clean
|
||||||
logger.fine("Completing callback DEPS for package %s (depth=%s)".formatted(packageName, depth));
|
logger.fine("Completing callback DEPS for package %s (depth=%s)".formatted(packageName, depth));
|
||||||
futurePackage.complete(new Package(name, version, repo, description, deps));
|
futurePackage.complete(new Package(name, version, repo, description, deps));
|
||||||
}
|
|
||||||
}).exceptionally((e2->{
|
}).exceptionally((e2->{
|
||||||
logger.warning("Error while fetching package %s (depth=%s) from the API : \n%s".formatted(packageName, depth, e2));
|
logger.warning("Error while fetching package %s (depth=%s) from the API : \n%s".formatted(packageName, depth, e2));
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user