DependencyTrack / DependencyTrack/dependency-track

metrics ossindex-api - failed with retry / without retry is always 0

Open
#3,999 4 comments 0 reactions 0 assignees View on GitHub
defect good first issue hacktoberfest p3 size/S
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior

In OssIndexAnalysisTask.java - submit method the implementation swallow http exception so configs on RETRY is never used and from this reason any http call is successful

try (final CloseableHttpResponse response = RETRY.executeCheckedSupplier(() -> HttpClientPool.getClient().execute(request))) {
HttpEntity responseEntity = response.getEntity();
String responseString = EntityUtils.toString(responseEntity);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
final OssIndexParser parser = new OssIndexParser();
return parser.parse(responseString);
} else {
**handleUnexpectedHttpResponse(LOGGER, apiBaseUrl, response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase());** **// you should throw Exception in handle method**
}
}

### Steps to Reproduce

1. Use invalid ApiKey, do a BOmUpload

### Expected Behavior

Metrics show failed ossindex call

### Dependency-Track Version

4.11.5

### Dependency-Track Distribution

Container Image

### Database Server

PostgreSQL

### Database Server Version

_No response_

### Browser

Google Chrome

### Checklist

- [X] I have read and understand the [contributing guidelines](https://github.com/DependencyTrack/dependency-track/blob/master/CONTRIBUTING.md#filing-issues)
- [X] I have checked the [existing issues](https://github.com/DependencyTrack/dependency-track/issues) for whether this defect was already reported

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.