aboutsummaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
diff options
context:
space:
mode:
authorwasala <przemyslaw.wasala@nokia.com>2018-09-11 09:50:21 +0200
committerwasala <przemyslaw.wasala@nokia.com>2018-09-11 19:51:20 +0200
commit4a1457c84c5f3a68ccdfb3e348996e14ccea89e8 (patch)
treecf83bbe8b29dfc720fe2fafa94b3b84d6c3a7379 /prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
parentfea7d735b49c4be0958c6531771cc2ee511db490 (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-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java')
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
index 862ad841..6cd54846 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
@@ -26,9 +26,7 @@ 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.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.slf4j.MDC;
@@ -37,8 +35,11 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.DefaultUriBuilderFactory;
import reactor.core.publisher.Mono;
+
+
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18
*/
@@ -74,12 +75,9 @@ public class DMaaPProducerReactiveHttpClient {
public Mono<ResponseEntity<String>> getDMaaPProducerResponse(ConsumerDmaapModel consumerDmaapModelMono) {
return Mono.defer(() -> {
- try {
- HttpEntity<String> request = new HttpEntity<>(createJsonBody(consumerDmaapModelMono), getAllHeaders());
- return Mono.just(restTemplate.exchange(getUri(), HttpMethod.POST, request, String.class));
- } catch (URISyntaxException e) {
- return Mono.error(e);
- }
+ HttpEntity<String> request = new HttpEntity<>(createJsonBody(consumerDmaapModelMono), getAllHeaders());
+ return Mono.just(restTemplate.exchange(getUri(), HttpMethod.POST, request, String.class));
+
});
}
@@ -97,9 +95,9 @@ public class DMaaPProducerReactiveHttpClient {
return this;
}
- URI getUri() throws URISyntaxException {
- return new URIBuilder().setScheme(dmaapProtocol).setHost(dmaapHostName).setPort(dmaapPortNumber)
- .setPath(dmaapTopicName).build();
+ URI getUri() {
+ return new DefaultUriBuilderFactory().builder().scheme(dmaapProtocol).host(dmaapHostName).port(dmaapPortNumber)
+ .path(dmaapTopicName).build();
}
}