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 6249040..b27a2fa 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 @@
 		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/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 8ee106e..9b975fa 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 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 254ae3b..b426c39 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 @@
        
         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 @@
         
         InfraActiveRequests infraActiveRequests = null;
         
-        if(dupList != null && dupList.size() > 0){
+        if(dupList != null && !dupList.isEmpty()){
         	infraActiveRequests = dupList.get(0);
         }
          	
@@ -284,40 +284,40 @@
     	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);
