diff options
author | 2025-02-21 17:11:14 +0000 | |
---|---|---|
committer | 2025-02-21 17:11:22 +0000 | |
commit | 674ca91dd0023862620db68ffc11b71617e111c9 (patch) | |
tree | cdc051e624a5c8323c02c9ab4d21f0df972919b4 /models-interactions | |
parent | aa178fb2979f5b185a397447c43250e841d2b27a (diff) |
fix sonar issues with http uplift
Issue-ID: POLICY-5189
Change-Id: I45f2e0b069bd8ee400fac8cdbba5e40edab729a5
Signed-off-by: akenihan <adam.kenihan@est.tech>
Diffstat (limited to 'models-interactions')
-rw-r--r-- | models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java | 15 | ||||
-rw-r--r-- | models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java index 48a02f07a..f585059a7 100644 --- a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java +++ b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java @@ -27,7 +27,6 @@ import jakarta.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Map.Entry; -import javax.net.ssl.SSLContext; import org.apache.commons.lang3.tuple.Pair; import org.apache.hc.client5.http.classic.methods.HttpDelete; import org.apache.hc.client5.http.classic.methods.HttpGet; @@ -39,8 +38,8 @@ import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy; import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; -import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.HttpHeaders; @@ -212,14 +211,10 @@ public class RestManager { var sslContext = SSLContexts.createDefault(); PoolingHttpClientConnectionManager connectionManager = - PoolingHttpClientConnectionManagerBuilder.create() - .setSSLSocketFactory( - SSLConnectionSocketFactoryBuilder.create() - .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) - .setSslContext(sslContext) - .build() - ) - .build(); + PoolingHttpClientConnectionManagerBuilder.create() + .setTlsSocketStrategy(new DefaultClientTlsStrategy( + sslContext, NoopHostnameVerifier.INSTANCE)) + .build(); try (CloseableHttpClient client = HttpClientBuilder.create().setConnectionManager(connectionManager).build()) { HttpResponse response = client.execute(request); diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java index 02ae7ece3..1bc3d6e34 100644 --- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java +++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java @@ -120,7 +120,7 @@ public class RestTest { assertThrows(NullPointerException.class, () -> { mgr.get(null, "user", null, null); }); - } + } @Test void testPutUrlNull() { |