use of com.synopsys.integration.blackduck.codelocation.binaryscanner.BinaryScanOutput in project synopsys-detect by blackducksoftware.
the class BinaryUploadOperation method throwExceptionForError.
// BinaryScanBatchOutput used to do this, but our understanding of what needs to happen has been
// changing rapidly. Once we're confident we know what it should do, it should presumably move back there.
private void throwExceptionForError(BinaryScanBatchOutput binaryScanBatchOutput) throws BlackDuckIntegrationException {
for (BinaryScanOutput binaryScanOutput : binaryScanBatchOutput) {
if (binaryScanOutput.getResult() == Result.FAILURE) {
// Black Duck responses are single-line message (loggable as-is), but nginx Bad Gateway responses are
// multi-line html with the message embedded (that mess up the log).
// cleanResponse() attempts to produce something reasonable to log in either case
String cleanedBlackDuckResponse = cleanResponse(binaryScanOutput.getResponse());
String uploadErrorMessage = String.format("Error when uploading binary scan: %s (Black Duck response: %s)", binaryScanOutput.getErrorMessage().orElse(binaryScanOutput.getStatusMessage()), cleanedBlackDuckResponse);
logger.error(uploadErrorMessage);
throw new BlackDuckIntegrationException(uploadErrorMessage);
}
}
}
Aggregations