aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java6
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java54
5 files changed, 38 insertions, 73 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
index 3b7089153f..bfd0d7dee4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
@@ -108,7 +108,7 @@ public class ApplicationControllerSupport {
try {
return (Status) statusReader.invoke(response);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(String.format("Unable to obtain status from LCM Kit response"), e);
+ throw new RuntimeException("Unable to obtain status from LCM Kit response", e);
}
}
return new Status();
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
index 6249040342..b27a2fa64e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
@@ -67,29 +67,12 @@ public class ReadConfigTask extends BaseTask {
synchronized (ReadConfigTask.class) {
if (properties == null) {
properties = new Properties();
-
- InputStream stream = null;
-
- try {
- stream = getClass().getResourceAsStream(thePropertiesFile);
-
- if (stream == null) {
- throw new IOException("Resource not found: " + thePropertiesFile);
- }
+ try (InputStream stream = getClass().getResourceAsStream(thePropertiesFile)) {
properties.load(stream);
- stream.close();
- stream = null;
-
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (Exception e) {
- msoLogger.debug("Exception:", e);
- }
- }
+ } catch (Exception e) {
+ msoLogger.debug("Exception at readResourceFile stream: " + e);
}
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
index 6b3cb5a1db..af38053fac 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
@@ -76,36 +76,18 @@ public class ReadFileTask extends BaseTask {
Object value = execution.getVariable(theInputVariable);
if (value == null) {
- InputStream xmlStream = null;
-
- try {
- xmlStream = getClass().getResourceAsStream(theFile);
-
- if (xmlStream == null) {
- throw new IOException("Resource not found: " + theFile);
- }
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(xmlStream));
+ try (InputStream xmlStream = getClass().getResourceAsStream(theFile);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(xmlStream))) {
StringBuilder output = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
output.append(line);
}
-
- xmlStream.close();
- xmlStream = null;
-
value = output.toString();
- } finally {
- if (xmlStream != null) {
- try {
- xmlStream.close();
- } catch (Exception e) {
- msoLogger.debug("Exception ", e);
- }
- }
+ } catch (Exception e) {
+ msoLogger.debug("Exception at readResourceFile stream: " + e);
}
}
execution.setVariable(theInputVariable, value);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index 8ee106efc1..9b975facc6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -586,20 +586,20 @@ public class MsoRequest {
public Map<String, List<String>> getOrchestrationFilters (MultivaluedMap<String, String> queryParams) throws ValidationException {
String queryParam = null;
- Map<String, List<String>> orchestrationFilterParams = new HashMap<String, List<String>>();
+ Map<String, List<String>> orchestrationFilterParams = new HashMap<>();
for (Entry<String,List<String>> entry : queryParams.entrySet()) {
queryParam = entry.getKey();
try{
- if(queryParam.equalsIgnoreCase("filter")){
+ if("filter".equalsIgnoreCase(queryParam)){
for(String value : entry.getValue()) {
StringTokenizer st = new StringTokenizer(value, ":");
int counter=0;
String mapKey=null;
- List<String> orchestrationList = new ArrayList<String>();
+ List<String> orchestrationList = new ArrayList<>();
while (st.hasMoreElements()) {
if(counter == 0){
mapKey = st.nextElement() + "";
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 254ae3bf39..b426c39176 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -226,37 +226,37 @@ public class RequestsDatabase {
if(instanceName != null && !instanceName.equals("")) {
- if(requestScope.equals("service")){
+ if("service".equals(requestScope)){
criteria.add (Restrictions.eq (SERVICE_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("vnf")){
+ } else if("vnf".equals(requestScope)){
criteria.add (Restrictions.eq (VNF_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("volumeGroup")){
+ } else if("volumeGroup".equals(requestScope)){
criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("vfModule")){
+ } else if("vfModule".equals(requestScope)){
criteria.add (Restrictions.eq (VFMODULE_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("network")){
+ } else if("network".equals(requestScope)){
criteria.add (Restrictions.eq (NETWORK_INSTANCE_NAME, instanceName));
}
} else {
if(instanceIdMap != null){
- if(requestScope.equals("service") && instanceIdMap.get("serviceInstanceId") != null){
+ if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){
criteria.add (Restrictions.eq (SERVICE_INSTANCE_ID, instanceIdMap.get("serviceInstanceId")));
}
- if(requestScope.equals("vnf") && instanceIdMap.get("vnfInstanceId") != null){
+ if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){
criteria.add (Restrictions.eq (VNF_INSTANCE_ID, instanceIdMap.get("vnfInstanceId")));
}
- if(requestScope.equals("vfModule") && instanceIdMap.get("vfModuleInstanceId") != null){
+ if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){
criteria.add (Restrictions.eq (VFMODULE_INSTANCE_ID, instanceIdMap.get("vfModuleInstanceId")));
}
- if(requestScope.equals("volumeGroup") && instanceIdMap.get("volumeGroupInstanceId") != null){
+ if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){
criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_ID, instanceIdMap.get("volumeGroupInstanceId")));
}
- if(requestScope.equals("network") && instanceIdMap.get("networkInstanceId") != null){
+ if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){
criteria.add (Restrictions.eq (NETWORK_INSTANCE_ID, instanceIdMap.get("networkInstanceId")));
}
}
@@ -270,7 +270,7 @@ public class RequestsDatabase {
InfraActiveRequests infraActiveRequests = null;
- if(dupList != null && dupList.size() > 0){
+ if(dupList != null && !dupList.isEmpty()){
infraActiveRequests = dupList.get(0);
}
@@ -284,40 +284,40 @@ public class RequestsDatabase {
for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet())
{
String mapKey = entry.getKey();
- if(mapKey.equalsIgnoreCase("serviceInstanceId")) {
+ if("serviceInstanceId".equalsIgnoreCase(mapKey)) {
mapKey = "serviceInstanceId";
- } else if(mapKey.equalsIgnoreCase("serviceInstanceName")) {
+ } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) {
mapKey = "serviceInstanceName";
- } else if(mapKey.equalsIgnoreCase("vnfInstanceId")){
+ } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){
mapKey = "vnfId";
- } else if(mapKey.equalsIgnoreCase("vnfInstanceName")) {
+ } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) {
mapKey = "vnfName";
- } else if(mapKey.equalsIgnoreCase("vfModuleInstanceId")) {
+ } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) {
mapKey = "vfModuleId";
- } else if(mapKey.equalsIgnoreCase("vfModuleInstanceName")) {
+ } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) {
mapKey = "vfModuleName";
- } else if(mapKey.equalsIgnoreCase("volumeGroupInstanceId")) {
+ } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) {
mapKey = "volumeGroupId";
- } else if(mapKey.equalsIgnoreCase("volumeGroupInstanceName")) {
+ } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) {
mapKey = "volumeGroupName";
- } else if(mapKey.equalsIgnoreCase("networkInstanceId")) {
+ } else if("networkInstanceId".equalsIgnoreCase(mapKey)) {
mapKey = "networkId";
- } else if(mapKey.equalsIgnoreCase("networkInstanceName")) {
+ } else if("networkInstanceName".equalsIgnoreCase(mapKey)) {
mapKey = "networkName";
- } else if(mapKey.equalsIgnoreCase("lcpCloudRegionId")) {
+ } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) {
mapKey = "aicCloudRegion";
- } else if(mapKey.equalsIgnoreCase("tenantId")) {
+ } else if("tenantId".equalsIgnoreCase(mapKey)) {
mapKey = "tenantId";
- } else if(mapKey.equalsIgnoreCase("modelType")) {
+ } else if("modelType".equalsIgnoreCase(mapKey)) {
mapKey = "requestScope";
- } else if(mapKey.equalsIgnoreCase("requestorId")) {
+ } else if("requestorId".equalsIgnoreCase(mapKey)) {
mapKey = "requestorId";
- } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) {
+ } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) {
mapKey = "startTime";
}
String propertyValue = entry.getValue().get(1);
- if (mapKey.equals("startTime")) {
+ if ("startTime".equals(mapKey)) {
SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
try {
Date thisDate = format.parse(propertyValue);