diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-11-17 14:58:32 +0100 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-11-17 14:58:32 +0100 |
commit | 15671ddfedd4e91eab98946bb75297e4f4d9e893 (patch) | |
tree | 9fd638289f6e2732885687af02feb9066b336425 /src/main/java | |
parent | 03061a307a144c3fbd567a4973fc182d3cd22316 (diff) |
Fix remaining SOnar
Resolve remaining sonar issues reported in Critical and Blocker
Change-Id: Id80bf15c78e93a454f2446cb563f5c29a186b3d4
Issue-ID: CLAMP-74
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java')
3 files changed, 35 insertions, 33 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java index e01a68fa..95715356 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java +++ b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java @@ -62,21 +62,21 @@ import org.springframework.context.ApplicationContext; * Policy utility methods - specifically, send the policy. */ public class PolicyClient { - protected static final String POLICY_PREFIX_BASE = "Config_"; - protected static final String POLICY_PREFIX_BRMS_PARAM = "Config_BRMS_Param_"; - protected static final String POLICY_PREFIX_MICROSERVICE = "Config_MS_"; - protected static final String LOG_POLICY_PREFIX = "Response is "; - protected static final EELFLogger logger = EELFManager.getInstance() - .getLogger(PolicyClient.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - protected static final String POLICY_MSTYPE_PROPERTY_NAME = "policy.ms.type"; - protected static final String POLICY_ONAPNAME_PROPERTY_NAME = "policy.onap.name"; + + protected static final String POLICY_PREFIX_BASE = "Config_"; + protected static final String POLICY_PREFIX_BRMS_PARAM = "Config_BRMS_Param_"; + protected static final String POLICY_PREFIX_MICROSERVICE = "Config_MS_"; + protected static final String LOG_POLICY_PREFIX = "Response is "; + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyClient.class); + protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + protected static final String POLICY_MSTYPE_PROPERTY_NAME = "policy.ms.type"; + protected static final String POLICY_ONAPNAME_PROPERTY_NAME = "policy.onap.name"; @Value("${org.onap.clamp.config.files.cldsPolicyConfig:'classpath:/clds/clds-policy-config.properties'}") - protected String cldsPolicyConfigFile; + protected String cldsPolicyConfigFile; @Autowired - protected ApplicationContext appContext; + protected ApplicationContext appContext; @Autowired - protected RefProp refProp; + protected RefProp refProp; /** * Perform BRMS policy type. @@ -88,7 +88,6 @@ public class PolicyClient { * @param policyRequestUuid * PolicyRequest UUID * @return The response message of policy - * */ public String sendBrmsPolicy(Map<AttributeType, Map<String, String>> attributes, ModelProperties prop, String policyRequestUuid) { @@ -331,7 +330,7 @@ public class PolicyClient { logger.info("Policy versions.size()=" + versions.size()); } catch (PolicyConfigException e) { // just print warning - if no policy version found - logger.warn("warning: policy not found...policy name - " + policyName, e.getMessage()); + logger.warn("policy not found...policy name - " + policyName, e); } return versions; } @@ -393,7 +392,6 @@ public class PolicyClient { * * @param prop * The ModelProperties - * * @return The response message from policy */ protected String deletePolicy(ModelProperties prop, String policyType) { diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java index 2c052c1a..625aea58 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java @@ -54,20 +54,21 @@ import org.springframework.stereotype.Repository; */ @Repository("cldsDao") public class CldsDao { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsDao.class); + + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsDao.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - private JdbcTemplate jdbcTemplateObject; - private SimpleJdbcCall procGetModel; - private SimpleJdbcCall procGetModelTemplate; - private SimpleJdbcCall procSetModel; - private SimpleJdbcCall procInsEvent; - private SimpleJdbcCall procUpdEvent; - private SimpleJdbcCall procSetTemplate; - private SimpleJdbcCall procGetTemplate; - private SimpleJdbcCall procDelAllModelInstances; - private SimpleJdbcCall procInsModelInstance; - private SimpleJdbcCall procDelModelInstance; - private static final String HEALTHCHECK = "Select 1"; + private JdbcTemplate jdbcTemplateObject; + private SimpleJdbcCall procGetModel; + private SimpleJdbcCall procGetModelTemplate; + private SimpleJdbcCall procSetModel; + private SimpleJdbcCall procInsEvent; + private SimpleJdbcCall procUpdEvent; + private SimpleJdbcCall procSetTemplate; + private SimpleJdbcCall procGetTemplate; + private SimpleJdbcCall procDelAllModelInstances; + private SimpleJdbcCall procInsModelInstance; + private SimpleJdbcCall procDelModelInstance; + private static final String HEALTHCHECK = "Select 1"; /** * Log message when instantiating @@ -421,11 +422,12 @@ public class CldsDao { List<CldsServiceData> cldsServiceDataList = new ArrayList<>(); try { String getCldsServiceSQL = "SELECT * , TIMESTAMPDIFF(SECOND, timestamp, CURRENT_TIMESTAMP()) FROM clds_service_cache where invariant_service_id = ? "; - cldsServiceData = jdbcTemplateObject.queryForObject(getCldsServiceSQL, new Object[] { invariantUUID }, - new CldsServiceDataMapper()); + cldsServiceData = jdbcTemplateObject.queryForObject(getCldsServiceSQL, new Object[] { + invariantUUID + }, new CldsServiceDataMapper()); logger.info("value of cldsServiceDataList: {}", cldsServiceDataList); } catch (EmptyResultDataAccessException e) { - logger.info("cache row not found for invariantUUID: {}", invariantUUID); + logger.warn("cache row not found for invariantUUID: " + invariantUUID, e); } return cldsServiceData; } diff --git a/src/main/java/org/onap/clamp/clds/service/CldsUser.java b/src/main/java/org/onap/clamp/clds/service/CldsUser.java index db8a24f3..af39991e 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsUser.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsUser.java @@ -26,8 +26,9 @@ package org.onap.clamp.clds.service; import java.util.Arrays; public class CldsUser { - private String user; - private String password; + + private String user; + private String password; private SecureServicePermission[] permissions; /** @@ -68,6 +69,7 @@ public class CldsUser { } public String[] getPermissionsString() { + // NOSONAR return Arrays.stream(getPermissions()).map(SecureServicePermission::getKey).toArray(String[]::new); } |