Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Analysis Service is token based, so for every analysis request a TOKEN is associ
##### Git Clone

```console
git clone https://github.com/reactome/AnalysisTools.git
cd AnalysisTools; cd Service
git clone https://github.com/reactome/AnalysisService.git
cd AnalysisService
```

##### Configuring Maven Profile :memo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void report(String ip, Long waitingTime, Long reportTime, Integer pages,
CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(reportUser, reportPassword);
provider.setCredentials(AuthScope.ANY, credentials);
CloseableHttpClient client = HttpClients.custom().setDefaultCredentialsProvider(provider).build();

URIBuilder uriBuilder = new URIBuilder(this.reportURL + "/report/analysis/pdf/waiting");
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("ip", ip));
Expand All @@ -171,12 +171,15 @@ private void report(String ip, Long waitingTime, Long reportTime, Integer pages,
uriBuilder.addParameters(params);

HttpGet httpGet = new HttpGet(uriBuilder.toString());
CloseableHttpResponse response = client.execute(httpGet);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
logger.error("[REP001] The url {} returned the code {} and the report hasn't been created.", uriBuilder, statusCode);

// Use try-with-resources to ensure both client and response are properly closed
try (CloseableHttpClient client = HttpClients.custom().setDefaultCredentialsProvider(provider).build();
CloseableHttpResponse response = client.execute(httpGet)) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
logger.error("[REP001] The url {} returned the code {} and the report hasn't been created.", uriBuilder, statusCode);
}
}
client.close();
} catch (ConnectException e) {
logger.error("[REP002] Report service is unavailable");
} catch (IOException | URISyntaxException e) {
Expand Down