Sonar:Critical 37/30437/1
authorSumapriya Sarvepalli <SS00493505@TechMahindra.com>
Tue, 6 Feb 2018 11:00:19 +0000 (16:30 +0530)
committerSumapriya Sarvepalli <SS00493505@TechMahindra.com>
Tue, 6 Feb 2018 11:01:26 +0000 (16:31 +0530)
Define and throw a dedicated exception instead of using a generic one
ApplicationControllerClient.java:L79 L121 L132

Link: https://sonar.onap.org/account/issues#resolved=false|rules=squid%3AS00112
Location:src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
Change-Id: Iba0d52ad2310fed17bb1012611e4ca0bf0ae2180
Issue-ID: SO-400
Signed-off-by: Sumapriya Sarvepalli <SS00493505@TechMahindra.com>
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java

index 26c1c4a..f66034f 100644 (file)
@@ -76,7 +76,7 @@ public class ApplicationControllerClient {
        private LifeCycleManagerStateful client;
 
        public Status runCommand(Action action, ActionIdentifiers identifier, Flags flags, Payload payload,
-                       String requestID) throws Exception {
+                       String requestID) throws IllegalAccessException,NoSuchMethodException,AppcClientException,JsonProcessingException,InvocationTargetException {
                Object requestObject = createRequest(action, identifier, flags, payload, requestID);
                client = getAppCClient();
                Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false);
@@ -118,7 +118,7 @@ public class ApplicationControllerClient {
        }
 
        public Object createRequest(Action action, ActionIdentifiers identifier, Flags flags, Payload payload,
-                       String requestId) throws Exception {
+                       String requestId) throws IllegalAccessException,NoSuchMethodException,InvocationTargetException {
                Object requestObject = appCSupport.getInput(action.name());
                try {
                        org.openecomp.appc.client.lcm.model.CommonHeader commonHeader = buildCommonHeader(requestId);
@@ -129,7 +129,7 @@ public class ApplicationControllerClient {
                                        .invoke(requestObject, identifier);
                } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
                    LOGGER.debug("Exception:", e);
-                       throw new Exception("Error Building AppC Request: " + e.getMessage());
+                       throw new IllegalAccessException("Error Building AppC Request: " + e.getMessage());
                }
                return requestObject;
        }