Search in sources :

Example 61 with CheckmarxException

use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class CxRepoFileHelper method getScaClonedRepoFolderPath.

public String getScaClonedRepoFolderPath(String repoUrlWithAuth, List<String> excludeFiles, String branch) throws CheckmarxException {
    CxScanParams cxScanParams = prepareScanParamsToCloneRepo(repoUrlWithAuth, excludeFiles, branch);
    File pathFile = null;
    try {
        pathFile = gitCloneAndRunPostCloneScript(cxScanParams);
    } catch (GitAPIException | URISyntaxException e) {
        log.error(ExceptionUtils.getRootCauseMessage(e));
        throw new CheckmarxException("Unable to clone Git Url.");
    }
    return pathFile.getAbsolutePath();
}
Also used : CxScanParams(com.checkmarx.sdk.dto.cx.CxScanParams) GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) CheckmarxException(com.checkmarx.sdk.exception.CheckmarxException) URISyntaxException(java.net.URISyntaxException) File(java.io.File)

Example 62 with CheckmarxException

use of com.checkmarx.sdk.exception.CheckmarxException in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class CxRepoFileHelper method prepareRepoFile.

public String prepareRepoFile(CxScanParams params) throws CheckmarxException {
    try {
        File pathFile = gitCloneAndRunPostCloneScript(params);
        String zipFilePath = zipClonedRepo(pathFile, params.getFileExclude());
        deleteCloneLocalDir(pathFile);
        return zipFilePath;
    } catch (GitAPIException | IOException | URISyntaxException e) {
        log.error(ExceptionUtils.getRootCauseMessage(e));
        throw new CheckmarxException("Unable to clone Git Url.");
    }
}
Also used : GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) CheckmarxException(com.checkmarx.sdk.exception.CheckmarxException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) File(java.io.File)

Aggregations

CheckmarxException (com.checkmarx.sdk.exception.CheckmarxException)62 HttpStatusCodeException (org.springframework.web.client.HttpStatusCodeException)23 ScanResults (com.checkmarx.sdk.dto.ScanResults)11 HttpEntity (org.springframework.http.HttpEntity)10 MachinaException (com.checkmarx.flow.exception.MachinaException)8 Test (org.junit.Test)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 File (java.io.File)6 JSONObject (org.json.JSONObject)6 CxProject (com.checkmarx.sdk.dto.cx.CxProject)5 CxScanParams (com.checkmarx.sdk.dto.cx.CxScanParams)4 IOException (java.io.IOException)4 JAXBContext (javax.xml.bind.JAXBContext)4 JAXBException (javax.xml.bind.JAXBException)4 Unmarshaller (javax.xml.bind.Unmarshaller)4 XMLInputFactory (javax.xml.stream.XMLInputFactory)3 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)3 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)3 SoapActionCallback (org.springframework.ws.soap.client.core.SoapActionCallback)3 ScanReport (com.checkmarx.flow.dto.report.ScanReport)2