use of com.hp.octane.integrations.exceptions.PermanentException in project octane-ci-java-sdk by MicroFocus.
the class VulnerabilitiesServiceImpl method processPushVulnerabilitiesQueueItem.
private boolean processPushVulnerabilitiesQueueItem(VulnerabilitiesQueueItem queueItem) {
try {
// if this is the first time in the queue , check if vulnerabilities relevant to octane, and if not remove it from the queue.
if (!queueItem.isRelevant()) {
Date relevant = vulnerabilitiesPreflightRequest(queueItem.getJobId(), queueItem.getBuildId());
if (relevant != null) {
logger.debug(configurer.octaneConfiguration.getLocationForLog() + queueItem.toString() + " , Relevant:" + relevant);
// set queue item value relevancy to true and continue
queueItem.setRelevant(true);
// for backward compatibility with Octane - if baselineDate is 2000-01-01 it means that we didn't get it from octane and we need to discard it
if (relevant.compareTo(DateUtils.getDateFromUTCString("2000-01-01", "yyyy-MM-dd")) > 0) {
queueItem.setBaselineDate(relevant);
}
} else {
// return with true to silently proceed to the next item
return true;
}
}
InputStream vulnerabilitiesStream = null;
if (queueItem.getToolType().equals(ToolType.SONAR)) {
vulnerabilitiesStream = sonarVulnerabilitiesService.getVulnerabilitiesScanResultStream(queueItem);
} else if (queueItem.getToolType().equals(ToolType.SSC)) {
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "SSC flow as expected");
vulnerabilitiesStream = sscService.getVulnerabilitiesScanResultStream(queueItem);
} else if (queueItem.getToolType().equals(ToolType.FOD)) {
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "Handling FOD queueItem");
vulnerabilitiesStream = fodService.getVulnerabilitiesScanResultStream(queueItem);
}
if (vulnerabilitiesStream == null) {
return false;
} else {
pushVulnerabilities(vulnerabilitiesStream, queueItem.getJobId(), queueItem.getBuildId());
return true;
}
} catch (IOException e) {
throw new PermanentException(e);
}
}
Aggregations