Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
fix fortify (#1651)
Browse files Browse the repository at this point in the history
* fix fortify

* ,
  • Loading branch information
CManole authored Dec 15, 2021
1 parent c5bd0fa commit 1245c66
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,11 @@ public Optional<ValidationServiceAllowlist> constructProtobufMapping() {

private ServiceProviderDto validateFingerprint(String serviceProviderAllowlistEndpoint,
String fingerPrintToCompare, final ObjectMapper objectMapper) {
try {
CloseableHttpClient httpClient = HttpClients.custom()
.setSSLHostnameVerifier((hostname, session) -> validateHostname(
session,
fingerPrintToCompare))
.build();

try (CloseableHttpClient httpClient = HttpClients.custom()
.setSSLHostnameVerifier((hostname, session) -> validateHostname(
session,
fingerPrintToCompare))
.build()) {
HttpGet getMethod = new HttpGet(serviceProviderAllowlistEndpoint);
final HttpEntity httpEntity = executeRequest(httpClient, getMethod);
return buildServiceProviderDto(objectMapper, httpEntity);
Expand Down Expand Up @@ -242,8 +240,7 @@ private boolean matches(final Certificate cert, final String fingerPrintToCompar

private HttpEntity executeRequest(CloseableHttpClient httpClient, HttpGet getMethod)
throws InvalidFingerprintException {
try {
final CloseableHttpResponse response = httpClient.execute(getMethod);
try (final CloseableHttpResponse response = httpClient.execute(getMethod)) {
return response.getEntity();
} catch (Exception e) {
LOGGER.warn("Request to obtain the service providers failed: ", e);
Expand Down

0 comments on commit 1245c66

Please sign in to comment.