diff options
author | Driptaroop Das <driptaroop.das@in.ibm.com> | 2019-01-22 15:17:52 +0530 |
---|---|---|
committer | Patrick Brady <patrick.brady@att.com> | 2019-01-30 21:46:44 +0000 |
commit | 9c9ba25dd74787ca0a6cd0e5811d7b56708acaa4 (patch) | |
tree | e79558df1d22d4a5a20bb932c84a9accc0189b55 | |
parent | 09da4f91bcfe2e9fb3eab992f2ead8c424a1cfad (diff) |
Multiple Sonar Fixes
Multiple Sonar Fixes
Issue-ID: APPC-1353
Change-Id: I5bdf2119e886a58606bf6192b97c9ae43e4e0069
Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
5 files changed, 13 insertions, 18 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ProviderAdapterImpl.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ProviderAdapterImpl.java index cd14ffadc..8c0a61bed 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ProviderAdapterImpl.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ProviderAdapterImpl.java @@ -40,8 +40,6 @@ import org.onap.appc.util.StructuredPropertyHelper.Node; import com.att.cdp.zones.model.Image; import com.att.cdp.zones.model.Server; import com.att.cdp.zones.model.Stack; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import java.util.HashMap; import java.util.List; @@ -274,7 +272,7 @@ public class ProviderAdapterImpl implements ProviderAdapter { String userId = null; String password = null; // domain is not required so set a default - String domain = DEFAULT_DOMAIN_NAME; + String domain = ProviderAdapterImpl.DEFAULT_DOMAIN_NAME; for (Node node2 : node.getChildren()) { switch (node2.getName()) { case Property.PROVIDER_TENANT_NAME: @@ -282,16 +280,18 @@ public class ProviderAdapterImpl implements ProviderAdapter { break; case Property.PROVIDER_TENANT_USERID: userId = node2.getValue(); - DEFAULT_USER = node2.getValue(); + ProviderAdapterImpl.DEFAULT_USER = node2.getValue(); break; case Property.PROVIDER_TENANT_PASSWORD: // convert password from Base64 encrypted string prefixed with 'enc:' password = EncryptionTool.getInstance().encrypt(node2.getValue()); - DEFAULT_PASS = node2.getValue(); + ProviderAdapterImpl.DEFAULT_PASS = node2.getValue(); break; case Property.PROVIDER_TENANT_DOMAIN: domain = node2.getValue(); - DEFAULT_DOMAIN = node2.getValue(); + ProviderAdapterImpl.DEFAULT_DOMAIN = node2.getValue(); + break; + default: break; } } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/RequestContext.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/RequestContext.java index 2456e274b..8c2833dfc 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/RequestContext.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/RequestContext.java @@ -193,10 +193,7 @@ public class RequestContext { } accumulatedTime += (now - startTime); startTime = now; - if (accumulatedTime > timeToLive) { - return false; - } - return true; + return !(accumulatedTime > timeToLive); } /** diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java index 73872040b..4fe0c2e33 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java @@ -312,9 +312,9 @@ public class ServiceCatalogV2 extends ServiceCatalog { }
}
builder.append(String.format("%d services:%n", serviceEndpoints.size())); //$NON-NLS-1$
- for (String serviceType : serviceEndpoints.keySet()) {
- List<Service.Endpoint> endpoints = serviceEndpoints.get(serviceType);
- Service service = serviceTypes.get(serviceType);
+ for(Map.Entry<String, List<Access.Service.Endpoint>> entry : serviceEndpoints.entrySet()){
+ List<Service.Endpoint> endpoints = entry.getValue();
+ Service service = serviceTypes.get(entry.getKey());
builder.append(String.format("\t%s [%s] - %d endpoints%n", service.getType(), service.getName(), //$NON-NLS-1$
endpoints.size()));
diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/MetricActivator.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/MetricActivator.java index 2e1958fa4..4d3c4e4ac 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/MetricActivator.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/MetricActivator.java @@ -36,8 +36,6 @@ import org.osgi.framework.ServiceRegistration; public class MetricActivator implements BundleActivator { - private ServiceRegistration registration = null; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(MetricActivator.class); @Override @@ -46,7 +44,7 @@ public class MetricActivator implements BundleActivator { MetricService impl = new MetricServiceImpl(); String regName = MetricService.class.getName(); logger.debug("Registering Metric service " + regName); - registration = bundleContext.registerService(regName, impl, null); + ServiceRegistration registration = bundleContext.registerService(regName, impl, null); logger.debug("Registered Metric service " + regName); } diff --git a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java index 27bf84a74..5a95e6e66 100644 --- a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java +++ b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java @@ -86,7 +86,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { log.debug("Cloud Owner" + cloudOwnerValue); log.debug("CloudRegionId" + cloudOwnerValue); - Map<String, String> paramsCloud = new HashMap<String, String>(); + Map<String, String> paramsCloud = new HashMap<>(); paramsCloud.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX)); @@ -178,7 +178,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { String vfModuleForVserver = vmServerCtx.getAttribute(responsePrefix + "vm.vf-module-id"); if (vnfcName != null) { - Map<String, String> paramsVnfc = new HashMap<String, String>(); + Map<String, String> paramsVnfc = new HashMap<>(); paramsVnfc.put(PARAM_VNFC_NAME, vnfcName); paramsVnfc.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, |