From 8e19307f1caf81527b495450c3f3c9cf0429a412 Mon Sep 17 00:00:00 2001 From: AvivSevillia <59255591+AvivCX@users.noreply.github.com> Date: Mon, 9 Nov 2020 13:26:31 +0200 Subject: [PATCH] fix cxgo-scan-completed status value (#20) * fix cxgo-scan-completed status value * replace with constants --- pom.xml | 2 +- src/main/java/com/cx/restclient/CxGoClientImpl.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index db908256..522bc7d5 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.github.checkmarx-ltd cx-spring-boot-sdk - 0.4.57 + 0.4.58 cx-spring-boot-sdk Checkmarx Java Spring Boot SDK diff --git a/src/main/java/com/cx/restclient/CxGoClientImpl.java b/src/main/java/com/cx/restclient/CxGoClientImpl.java index d93b400c..eaabf77c 100644 --- a/src/main/java/com/cx/restclient/CxGoClientImpl.java +++ b/src/main/java/com/cx/restclient/CxGoClientImpl.java @@ -81,6 +81,9 @@ public class CxGoClientImpl implements ScannerClient { private static final String DEEP_LINK = "/scan/business-unit/%s/application/%s/project/%s/scans/%s"; private static final String SCA_DEEP_LINK = "/scan/business-unit/%s/application/%s/project/%s"; private static final String ADDITIONAL_DETAILS_KEY = "results"; + private static final String CXGO_SCAN_STATUS_DONE = "Done"; + private static final String CXGO_SCAN_STATUS_PARTIAL = "Partial"; + private static final String CXGO_SCAN_STATUS_COMPLETED = "Completed"; /// CxOD required extra information for API calls not used by the SAST SDK. This /// data structure is used to capture that information as CxService calls are made @@ -866,8 +869,9 @@ private void setupScanIdMap(Integer scanID, Integer projectID) { public Integer getLastScanId(Integer projectId) { OdScanList appList = getScanStatusPage(projectId); for(OdScanListDataItem item : appList.getData().getItems()) { - if(item.getStatus().equals("Done")) { + if(item.getStatus().equals(CXGO_SCAN_STATUS_DONE) || item.getStatus().equals(CXGO_SCAN_STATUS_PARTIAL) || item.getStatus().equals(CXGO_SCAN_STATUS_COMPLETED)) { this.setupScanIdMap(item.getId(), projectId); + log.debug("getLastScanId - Found scanId '{}', with status: '{}'", item.getId(), item.getStatus()); return item.getId(); } }