diff options
author | wasala <przemyslaw.wasala@nokia.com> | 2018-09-11 09:50:21 +0200 |
---|---|---|
committer | wasala <przemyslaw.wasala@nokia.com> | 2018-09-11 19:51:20 +0200 |
commit | 4a1457c84c5f3a68ccdfb3e348996e14ccea89e8 (patch) | |
tree | cf83bbe8b29dfc720fe2fafa94b3b84d6c3a7379 /prh-aai-client/src/main | |
parent | fea7d735b49c4be0958c6531771cc2ee511db490 (diff) |
PRH:security vulnerabilities fix
*Removed unused libraries
*Fixed vulnerablities in connection
with clm scan
*Replaced AssertJ in tests verification
by using StepVerifier
Change-Id: I81c3ac54e5514735f0fca8150fcc218d96dc5ce3
Issue-ID: DCAEGEN2-770
Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-aai-client/src/main')
-rw-r--r-- | prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java index 4e0758c1..9e282cde 100644 --- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java +++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java @@ -26,17 +26,19 @@ import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.X_INVOCA import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.X_ONAP_REQUEST_ID; import java.net.URI; -import java.net.URISyntaxException; import java.util.UUID; -import org.apache.http.client.utils.URIBuilder; + import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration; import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel; import org.slf4j.MDC; import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.util.DefaultUriBuilderFactory; import reactor.core.publisher.Mono; + + public class AaiProducerReactiveHttpClient { private WebClient webClient; @@ -66,11 +68,7 @@ public class AaiProducerReactiveHttpClient { * @return status code of operation */ public Mono<ClientResponse> getAaiProducerResponse(ConsumerDmaapModel consumerDmaapModelMono) { - try { - return patchAaiRequest(consumerDmaapModelMono); - } catch (URISyntaxException e) { - return Mono.error(e); - } + return patchAaiRequest(consumerDmaapModelMono); } public AaiProducerReactiveHttpClient createAaiWebClient(WebClient webClient) { @@ -78,7 +76,7 @@ public class AaiProducerReactiveHttpClient { return this; } - private Mono<ClientResponse> patchAaiRequest(ConsumerDmaapModel dmaapModel) throws URISyntaxException { + private Mono<ClientResponse> patchAaiRequest(ConsumerDmaapModel dmaapModel) { return webClient.patch() .uri(getUri(dmaapModel.getSourceName())) @@ -88,12 +86,8 @@ public class AaiProducerReactiveHttpClient { .exchange(); } - URI getUri(String pnfName) throws URISyntaxException { - return new URIBuilder() - .setScheme(aaiProtocol) - .setHost(aaiHost) - .setPort(aaiHostPortNumber) - .setPath(aaiBasePath + aaiPnfPath + "/" + pnfName) - .build(); + URI getUri(String pnfName) { + return new DefaultUriBuilderFactory().builder().scheme(aaiProtocol).host(aaiHost).port(aaiHostPortNumber) + .path(aaiBasePath + aaiPnfPath + "/" + pnfName).build(); } } |