Skip to content

Commit

Permalink
Fixed error on ScannerProperty.
Browse files Browse the repository at this point in the history
  • Loading branch information
PiekJ committed Jul 8, 2020
1 parent 9c35f70 commit f925fb7
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ public DecorationResult decorateQualityGateStatus(AnalysisDetails analysis, AlmS

try {
final String apiURL = Optional.ofNullable(StringUtils.stripToNull(almSettingDto.getUrl()))
.orElse(analysis.getScannerProperty(PULLREQUEST_GITLAB_INSTANCE_URL)
.orElseThrow(() -> new IllegalStateException(String.format(
"Could not decorate Gitlab merge request. '%s' has not been set in scanner properties",
PULLREQUEST_GITLAB_INSTANCE_URL))));
.orElseGet(() -> analysis.getScannerProperty(PULLREQUEST_GITLAB_INSTANCE_URL)
.orElseThrow(() -> new IllegalStateException(String.format(
"Could not decorate Gitlab merge request. '%s' has not been set in scanner properties",
PULLREQUEST_GITLAB_INSTANCE_URL))));
final String apiToken = almSettingDto.getPersonalAccessToken();
final String projectId = analysis.getScannerProperty(PULLREQUEST_GITLAB_PROJECT_ID).orElseThrow(
() -> new IllegalStateException(String.format(
"Could not decorate Gitlab merge request. '%s' has not been set in scanner properties",
PULLREQUEST_GITLAB_PROJECT_ID)));
final String projectId = Optional.ofNullable(StringUtils.stripToNull(projectAlmSettingDto.getAlmRepo()))
.orElseGet(() -> analysis.getScannerProperty(PULLREQUEST_GITLAB_PROJECT_ID)
.orElseThrow(() -> new IllegalStateException(String.format(
"Could not decorate Gitlab merge request. '%s' has not been set in scanner properties",
PULLREQUEST_GITLAB_PROJECT_ID))));
final String pullRequestId = analysis.getBranchName();

final String projectURL = apiURL + String.format("/projects/%s", URLEncoder
Expand Down

0 comments on commit f925fb7

Please sign in to comment.