From af26150154f3c49d63c0074f4f85d4c9e632dfb4 Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Thu, 30 May 2019 14:27:16 +0200 Subject: Improvements in RequestClient Improvements in RequestClient according to the Sonar analysis. Removed unnecessary exceptions handling. Added junit tests. Fixed imports. Issue-ID: SO-1945 Signed-off-by: Robert Bogacki Change-Id: Iee22e7dbeb39ca28c437f9a8a804b81945cb9bc5 --- .../java/org/onap/so/apihandler/common/RequestClient.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java/org') diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java index 9b7801711f..318b3ba5af 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java @@ -25,7 +25,6 @@ package org.onap.so.apihandler.common; import java.io.IOException; import java.security.GeneralSecurityException; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; @@ -70,22 +69,12 @@ public abstract class RequestClient { public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException; - public abstract HttpResponse post(String request) throws ClientProtocolException, IOException; + public abstract HttpResponse post(String request) throws IOException; - public abstract HttpResponse post(RequestClientParameter parameterObject) - throws ClientProtocolException, IOException; + public abstract HttpResponse post(RequestClientParameter parameterObject) throws IOException; public abstract HttpResponse get() throws IOException; - protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) { - try { - return CryptoUtils.decrypt(prop, encryptionKey); - } catch (GeneralSecurityException e) { - logger.debug("Security exception", e); - } - return defaultValue; - } - protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) { try { return CryptoUtils.decrypt(prop, encryptionKey); -- cgit 1.2.3-korg