Skip to content

Commit

Permalink
Adding checks to see if git org is null.
Browse files Browse the repository at this point in the history
  • Loading branch information
avimanyum committed Nov 8, 2021
1 parent 8d806a7 commit dc9f5bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ public void execute(final Namespace ns, final DockerfileGitHubUtil dockerfileGit
Integer gitApiSearchLimit = ns.get(Constants.GIT_API_SEARCH_LIMIT);
List<IOException> exceptions = new ArrayList<>();
Map<String, Boolean> orgsToIncludeInSearch = new HashMap<>();
orgsToIncludeInSearch.put(ns.get(Constants.GIT_ORG), true);
if (ns.get(Constants.GIT_ORG) != null) {
// If there is a Git org specified, that needs to be included in the search query. In
// the orgsToIncludeInSearch a true value associated with an org name ensures that
// the org gets included in the search query.
orgsToIncludeInSearch.put(ns.get(Constants.GIT_ORG), true);
}
for (Map.Entry<String, JsonElement> imageToTag : imageToTagStore) {
String image = imageToTag.getKey();
log.info("Repositories with image {} being forked.", image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,12 @@ public Optional<List<PagedSearchIterable<GHContent>>> getGHContents(String org,
throws IOException, InterruptedException {
Optional<List<PagedSearchIterable<GHContent>>> contentsWithImage = Optional.empty();
Map<String, Boolean> orgsToIncludeInSearch = new HashMap<>();
orgsToIncludeInSearch.put(org, true);
if (org != null) {
// If there is a Git org specified, that needs to be included in the search query. In
// the orgsToIncludeInSearch a true value associated with an org name ensures that
// the org gets included in the search query.
orgsToIncludeInSearch.put(org, true);
}
for (int i = 0; i < 5; i++) {
contentsWithImage = findFilesWithImage(img, orgsToIncludeInSearch, gitApiSearchLimit);
if (contentsWithImage
Expand Down

0 comments on commit dc9f5bc

Please sign in to comment.