summaryrefslogtreecommitdiffstats
path: root/aai-service/provider
diff options
context:
space:
mode:
Diffstat (limited to 'aai-service/provider')
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java53
1 files changed, 22 insertions, 31 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
index 6eb53746..85e81b54 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
@@ -49,8 +49,6 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.Response;
import org.apache.commons.codec.binary.Base64;
import org.onap.ccsdk.sli.adaptors.aai.AAIService.TransactionIdTracker;
@@ -67,6 +65,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.client.urlconnection.HTTPSProperties;
+import org.apache.http.impl.EnglishReasonPhraseCatalog;
/**
* The AAIClientRESTExecutor class provides CRUD API for AAI Client service.
@@ -201,6 +200,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
}
private static final Logger LOG = LoggerFactory.getLogger(AAIService.class);
+ private static final String NOT_PROVIDED = "NOT PROVIDED";
private final MetricLogger ml = new MetricLogger();
private SSLContext CTX;
@@ -260,15 +260,13 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
try {
responseMessage = con.getResponseMessage();
} catch(Exception exc) {
- Status status = Response.Status.fromStatusCode(responseCode) ;
- if(status != null && status.getReasonPhrase() != null)
- responseMessage = status.getReasonPhrase();
- else
- responseMessage = "NOT PROVIDED";
+ responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null);
+ if(responseMessage == null)
+ responseMessage = NOT_PROVIDED;
}
// Process the response
- LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
+ LOG.info("HttpURLConnection result: {} : {}", responseCode, responseMessage);
logMetricResponse(responseCode, responseMessage);
if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8));
@@ -403,14 +401,12 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
try {
responseMessage = con.getResponseMessage();
} catch(Exception exc) {
- Status status = Response.Status.fromStatusCode(responseCode) ;
- if(status != null && status.getReasonPhrase() != null)
- responseMessage = status.getReasonPhrase();
- else
- responseMessage = "NOT PROVIDED";
+ responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null);
+ if(responseMessage == null)
+ responseMessage = NOT_PROVIDED;
}
- LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
+ LOG.info("HttpURLConnection result: {} : {}", responseCode, responseMessage);
logMetricResponse(responseCode, responseMessage);
// Process the response
@@ -486,15 +482,13 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
try {
responseMessage = conn.getResponseMessage();
} catch(Exception exc) {
- Status status = Response.Status.fromStatusCode(responseCode) ;
- if(status != null && status.getReasonPhrase() != null)
- responseMessage = status.getReasonPhrase();
- else
- responseMessage = "NOT PROVIDED";
+ responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null);
+ if(responseMessage == null)
+ responseMessage = NOT_PROVIDED;
}
// Process the response
- LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
+ LOG.info("HttpURLConnection result: {} : {}", responseCode, responseMessage);
logMetricResponse(responseCode, responseMessage);
if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8));
@@ -569,13 +563,12 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
try {
responseMessage = con.getResponseMessage();
} catch(Exception exc) {
- Status status = Response.Status.fromStatusCode(responseCode) ;
- if(status != null && status.getReasonPhrase() != null)
- responseMessage = status.getReasonPhrase();
- else
- responseMessage = "NOT PROVIDED";
+ responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null);
+ if(responseMessage == null)
+ responseMessage = NOT_PROVIDED;
}
+ LOG.info("HttpURLConnection result: {} : {}", responseCode, responseMessage);
logMetricResponse(responseCode, responseMessage);
ObjectMapper mapper = AAIService.getObjectMapper();
@@ -644,14 +637,12 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
try {
responseMessage = con.getResponseMessage();
} catch(Exception exc) {
- Status status = Response.Status.fromStatusCode(responseCode) ;
- if(status != null && status.getReasonPhrase() != null)
- responseMessage = status.getReasonPhrase();
- else
- responseMessage = "NOT PROVIDED";
+ responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null);
+ if(responseMessage == null)
+ responseMessage = NOT_PROVIDED;
}
- LOG.info("HttpURLConnection result: " + responseCode + " : " + responseMessage);
+ LOG.info("HttpURLConnection result: {} : {}", responseCode, responseMessage);
logMetricResponse(responseCode, responseMessage);
// Process the response