summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-02-08 19:46:35 +0100
committerPatrick Brady <pb071s@att.com>2018-02-09 23:49:20 +0000
commitde30efcf2cf03577adbd46be2eb2e074a177dfd2 (patch)
tree2fd4556d612b4985fae1050bbb3e28f5e88ea044
parent75376a9f115758db1a6411113bb82fd55e919a72 (diff)
ServiceExecutor sonar fixes
Change-Id: Id169ae3943c74893d885b8be098af96e44292ce5 Issue-ID: APPC-585 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
-rw-r--r--appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ExecutorException.java8
-rw-r--r--appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ServiceExecutor.java44
2 files changed, 27 insertions, 25 deletions
diff --git a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ExecutorException.java b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ExecutorException.java
new file mode 100644
index 000000000..c20a84f06
--- /dev/null
+++ b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ExecutorException.java
@@ -0,0 +1,8 @@
+package org.onap.appc.interfaces.service.executor;
+
+public class ExecutorException extends Exception{
+
+ public ExecutorException(String message) {
+ super(message);
+ }
+}
diff --git a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ServiceExecutor.java b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ServiceExecutor.java
index f72157656..ea445ce07 100644
--- a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ServiceExecutor.java
+++ b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executor/ServiceExecutor.java
@@ -24,40 +24,34 @@
package org.onap.appc.interfaces.service.executor;
-import java.io.IOException;
-
-import org.onap.appc.interfaces.service.InterfacesServiceProviderImpl;
import org.onap.appc.interfaces.service.executorImpl.ServiceExecutorImpl;
import org.onap.appc.interfaces.service.utils.ServiceConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
public class ServiceExecutor {
private static final Logger log = LoggerFactory.getLogger(ServiceExecutor.class);
- public String execute(String action, String requestData, String requestDataType) throws Exception{
- String response = null;
+
+ public String execute(String action, String requestData, String requestDataType) throws Exception {
+ String response;
log.info("Received execute request for action : " + action + " with Payload : " + requestData);
- try{
- RequestValidator.validate(action, requestData, requestData);
- switch (action) {
- case ServiceConstants.REQUESTOVERLAP:
- response = isRequestOverLap(requestData);
- break;
- case ServiceConstants.GEDATABYMODEL:
- response = getDataByModel(action, requestData, requestDataType);
- break;
- default:
- throw new Exception(" Action " + action + " not found while processing request ");
+ try {
+ RequestValidator.validate(action, requestData, requestData);
+ switch (action) {
+ case ServiceConstants.REQUESTOVERLAP:
+ response = isRequestOverLap(requestData);
+ break;
+ case ServiceConstants.GEDATABYMODEL:
+ response = getDataByModel(action, requestData, requestDataType);
+ break;
+ default:
+ throw new ExecutorException(" Action " + action + " not found while processing request ");
+ }
+ } catch (Exception e) {
+ log.info("Error while checking for ScopeOverlap", e);
+ throw e;
}
- }catch(Exception e){
- log.info("Error while checking for ScopeOverlap " + e.getMessage());
- e.printStackTrace();
- throw e;
- }
return response;
}
@@ -72,7 +66,7 @@ public class ServiceExecutor {
try {
return serviceExecutor.isRequestOverLap(requestData);
} catch (Exception e) {
- e.printStackTrace();
+ log.error("Error while checking for request overlap", e);
throw e;
}
}