From b392fac0c16df676a152753bf293399ba83c44f8 Mon Sep 17 00:00:00 2001 From: satyamchaurasiapersistent <102941840+satyamchaurasiapersistent@users.noreply.github.com> Date: Wed, 21 Sep 2022 15:58:58 +0530 Subject: [PATCH] Adding Git API exception --- pom.xml | 2 +- .../checkmarx/sdk/utils/CxRepoFileHelper.java | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 3fe50bec..ae2646f4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ cx-spring-boot-sdk - 0.5.28 + 0.5.29 cx-spring-boot-sdk diff --git a/src/main/java/com/checkmarx/sdk/utils/CxRepoFileHelper.java b/src/main/java/com/checkmarx/sdk/utils/CxRepoFileHelper.java index b26dffa7..7e18c1d3 100644 --- a/src/main/java/com/checkmarx/sdk/utils/CxRepoFileHelper.java +++ b/src/main/java/com/checkmarx/sdk/utils/CxRepoFileHelper.java @@ -176,14 +176,18 @@ else if (gitURL.contains("@bitbucket.org")) { log.info("credentialsProvider without password"); } log.info("Cloning code locally to {}", pathFile); - Git.cloneRepository() - .setURI(gitURL) - .setBranch(branch) - .setBranchesToClone(Collections.singleton(branch)) - .setDirectory(pathFile) - .setCredentialsProvider(credentialsProvider) - .call() - .close(); + try { + Git.cloneRepository() + .setURI(gitURL) + .setBranch(branch) + .setBranchesToClone(Collections.singleton(branch)) + .setDirectory(pathFile) + .setCredentialsProvider(credentialsProvider) + .call() + .close(); + } catch (GitAPIException e) { + log.error("API Exception : ",e); + } } private void runPostCloneScript(CxScanParams params, String path) {