Skip to content

Commit

Permalink
fixed null pointer exception in ConfigurationOverrider
Browse files Browse the repository at this point in the history
  • Loading branch information
HussainS12 authored Feb 7, 2022
1 parent 59f51ea commit a4aea0d
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,20 @@ private void overrideMainProperties(Optional<CxConfig> override, ScanRequest req
.filter(StringUtils::isNotBlank)
.ifPresent(p -> {
/*Replace ${repo} and ${branch} with the actual reponame and branch - then strip out non-alphanumeric (-_ are allowed)*/
String project = p.replace("${repo}", request.getRepoName())
.replace("${branch}", request.getBranch());
String project = p;
String repoName = request.getRepoName();
if (repoName != null) {
project = project.replace("${repo}", request.getRepoName());
} else {
log.warn("Error overriding main properties: Repo name is not defined.");
}

String branch = request.getBranch();
if (branch != null) {
project = project.replace("${branch}", request.getBranch());
} else {
log.warn("Error overriding main properties: Branch is not defined.");
}
request.setProject(project);
overrideReport.put("project", project);
});
Expand Down

0 comments on commit a4aea0d

Please sign in to comment.