aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-08-13 13:38:06 +0900
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-08-16 09:27:14 +0000
commitdfbc8abd0f1c151e34d07defbe0a5ff363fcf1f0 (patch)
treea0e533fc3596ae82ed169f7dd752163210ff8ee8 /bpmn
parente536a1035d0f224de32f76a1226c772b8f8d7c01 (diff)
Sonar fix in MSOCommonBPMN
Either log or rethrow this exception Remove this useless assignment to local variable "serviceInstance" Remove the declaration of thrown exception which is a runtime exception Move the string literal on the left side of this string comparison Issue-ID: SO-1841 Change-Id: I24cdd3682eddd2e5ceb7e961477a61457ef91ab2 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java19
2 files changed, 18 insertions, 18 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 09a5424d47..be53e505ac 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -104,6 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default serviceType value
+ logger.error("Exception in serviceType retrivel", ex);
}
String vnfType = ASTERISK;
try {
@@ -115,6 +116,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default vnfType value
+ logger.error("Exception in vnfType retrivel", ex);
}
String errorCode = ASTERISK;
@@ -122,12 +124,14 @@ public class ExecuteBuildingBlockRainyDay {
errorCode = "" + workflowException.getErrorCode();
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
String workStep = ASTERISK;
@@ -135,6 +139,7 @@ public class ExecuteBuildingBlockRainyDay {
workStep = workflowException.getWorkStep();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in workStep retrivel", ex);
}
String errorMessage = ASTERISK;
@@ -142,6 +147,7 @@ public class ExecuteBuildingBlockRainyDay {
errorMessage = workflowException.getErrorMessage();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in errorMessage retrivel", ex);
}
String serviceRole = ASTERISK;
@@ -177,14 +183,14 @@ public class ExecuteBuildingBlockRainyDay {
logger.error("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
}
- if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
+ if ("RollbackToAssigned".equals(handlingCode) && !aLaCarte) {
handlingCode = "Rollback";
}
if (handlingCode.startsWith("Rollback")) {
String targetState = "";
- if (handlingCode.equalsIgnoreCase("RollbackToAssigned")) {
+ if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
- } else if (handlingCode.equalsIgnoreCase("RollbackToCreated")) {
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_CREATED.toString();
} else {
targetState = Status.ROLLED_BACK.toString();
@@ -204,7 +210,7 @@ public class ExecuteBuildingBlockRainyDay {
int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
execution.setVariable("maxRetries", envMaxRetries);
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
execution.setVariable("maxRetries", 5);
}
}
@@ -247,8 +253,7 @@ public class ExecuteBuildingBlockRainyDay {
request.setLastModifiedBy("CamundaBPMN");
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
- logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: "
- + e.getMessage());
+ logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: ", e);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index b2dbd97bfc..aee28cae00 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -90,7 +90,6 @@ public class ExtractPojosForBB {
result = lookupObjectInList(serviceInstance.getConfigurations(), value);
break;
case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
break;
case VPN_BONDING_LINK_ID:
@@ -107,8 +106,9 @@ public class ExtractPojosForBB {
} catch (BBObjectNotFoundException e) { // re-throw parent object not found
throw e;
} catch (Exception e) { // convert all other exceptions to object not found
- logger.warn("BBObjectNotFoundException in ExtractPojosForBB",
- "BBObject " + key + " was not found in " + "gBBInput using reference value: " + value);
+ logger.warn(
+ "BBObjectNotFoundException in ExtractPojosForBB, BBObject {} was not found in gBBInput using reference value: {} {}",
+ key, value, e);
throw new BBObjectNotFoundException(key, value);
}
@@ -119,13 +119,8 @@ public class ExtractPojosForBB {
}
}
- protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- return findValue(obj, value);
- }
-
- protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ protected <T> Optional<T> lookupObjectInList(List<?> list, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Optional<T> result = Optional.empty();
for (Object obj : list) {
result = findValue(obj, value);
@@ -137,8 +132,8 @@ public class ExtractPojosForBB {
}
- protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ protected <T> Optional<T> findValue(Object obj, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
for (Field field : obj.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Id.class)) {
String fieldName = field.getName();