use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainDataTraceLogID in project sechub by mercedes-benz.
the class ScanService method executeScan.
protected void executeScan(SecHubExecutionContext context, DomainMessage request) throws SecHubExecutionException {
DomainDataTraceLogID sechubJobUUID = traceLogID(request);
LOG.info("start scan for {}", sechubJobUUID);
UUID logUUID = scanLogService.logScanStarted(context);
try {
BatchJobMessage jobIdMessage = request.get(MessageDataKeys.BATCH_JOB_ID);
if (jobIdMessage == null) {
throw new IllegalStateException("no batch job id set for sechub job:" + sechubJobUUID);
}
long batchJobId = jobIdMessage.getBatchJobId();
ProgressMonitor progressMonitor = monitorFactory.createProgressMonitor(batchJobId);
/* delegate execution : */
ScanJobExecutor executor = new ScanJobExecutor(this, context, progressMonitor, millisecondsToWaitBeforeCancelCheck);
executor.execute();
scanLogService.logScanEnded(logUUID);
} catch (Exception e) {
if (context.isAbandonded()) {
scanLogService.logScanAbandoned(logUUID);
} else {
scanLogService.logScanFailed(logUUID);
}
/* rethrow when already an execution exception */
if (e instanceof SecHubExecutionException) {
SecHubExecutionException exceptionToRethrow = (SecHubExecutionException) e;
throw exceptionToRethrow;
}
/* wrap it */
throw new SecHubExecutionException("Execute scan failed", e);
}
}
Aggregations