From 699e40b32ad965d63c61a1602f56a54d30940e4e Mon Sep 17 00:00:00 2001 From: rama-huawei Date: Thu, 21 Sep 2017 18:20:13 +0530 Subject: Removed useless parentheses Added diamond symbol on RHS Issue-ID: POLICY-239 Change-Id: I24c138703047308c2e28fef2180a0bb64400c1c9 Signed-off-by: rama-huawei --- .../statemanagement/DroolsPDPIntegrityMonitor.java | 52 +++++++++++----------- .../drools/statemanagement/RepositoryAudit.java | 29 ++++++------ .../statemanagement/StateManagementProperties.java | 3 ++ 3 files changed, 45 insertions(+), 39 deletions(-) (limited to 'feature-state-management/src/main') diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPDPIntegrityMonitor.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPDPIntegrityMonitor.java index 2dc2e262..3b7410fa 100644 --- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPDPIntegrityMonitor.java +++ b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPDPIntegrityMonitor.java @@ -87,62 +87,62 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor if (resourceName == null) { logger.error("init: Missing IntegrityMonitor property: 'resource.name'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'resource.name'")); + throw new Exception + ("Missing IntegrityMonitor property: 'resource.name'"); } if (hostPort == null) { logger.error("init: Missing IntegrityMonitor property: 'hostPort'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'hostPort'")); + throw new Exception + ("Missing IntegrityMonitor property: 'hostPort'"); } if (fpMonitorInterval == null) { logger.error("init: Missing IntegrityMonitor property: 'fp_monitor_interval'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'fp_monitor_interval'")); + throw new Exception + ("Missing IntegrityMonitor property: 'fp_monitor_interval'"); } if (failedCounterThreshold == null) { logger.error("init: Missing IntegrityMonitor property: 'failed_counter_threshold'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'failed_counter_threshold'")); + throw new Exception + ("Missing IntegrityMonitor property: 'failed_counter_threshold'"); } if (testTransInterval == null) { logger.error("init: Missing IntegrityMonitor property: 'test_trans_interval'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'test_trans_interval'")); + throw new Exception + ("Missing IntegrityMonitor property: 'test_trans_interval'"); } if (writeFpcInterval == null) { logger.error("init: Missing IntegrityMonitor property: 'write_fpc_interval'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'write_fpc_interval'")); + throw new Exception + ("Missing IntegrityMonitor property: 'write_fpc_interval'"); } if (siteName == null) { logger.error("init: Missing IntegrityMonitor property: 'site_name'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'site_name'")); + throw new Exception + ("Missing IntegrityMonitor property: 'site_name'"); } if (nodeType == null) { logger.error("init: Missing IntegrityMonitor property: 'node_type'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'node_type'")); + throw new Exception + ("Missing IntegrityMonitor property: 'node_type'"); } if (dependencyGroups == null) { logger.error("init: Missing IntegrityMonitor property: 'dependency_groups'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'dependency_groups'")); + throw new Exception + ("Missing IntegrityMonitor property: 'dependency_groups'"); } if (javaxPersistenceJdbcDriver == null) { logger.error("init: Missing IntegrityMonitor property: 'javax.persistence.jbdc.driver for xacml DB'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.driver for xacml DB'")); + throw new Exception + ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.driver for xacml DB'"); } if (javaxPersistenceJdbcUrl == null) { @@ -153,14 +153,14 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor if (javaxPersistenceJdbcUser == null) { logger.error("init: Missing IntegrityMonitor property: 'javax.persistence.jbdc.user for xacml DB'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.user for xacml DB'")); + throw new Exception + ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.user for xacml DB'"); } if (javaxPersistenceJdbcPassword == null) { logger.error("init: Missing IntegrityMonitor property: 'javax.persistence.jbdc.password for xacml DB'"); - throw(new Exception - ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.password' for xacml DB'")); + throw new Exception + ("Missing IntegrityMonitor property: 'javax.persistence.jbdc.password' for xacml DB'"); } // Now that we've validated the properties, create Drools Integrity Monitor @@ -300,7 +300,7 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor */ public String getName() { - return(name); + return name; } /** @@ -308,7 +308,7 @@ public class DroolsPDPIntegrityMonitor extends IntegrityMonitor */ public String getResponse() { - return(response); + return response; } /** diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java index 84cb7e32..7eed736e 100644 --- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java +++ b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java @@ -53,7 +53,7 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase */ static DroolsPDPIntegrityMonitor.AuditBase getInstance() { - return(instance); + return instance; } /** @@ -123,8 +123,8 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase String repositoryPassword = StateManagementProperties.getProperty("repository.audit.password"); boolean upload = - (repositoryId != null && repositoryUrl != null - && repositoryUsername != null && repositoryPassword != null); + repositoryId != null && repositoryUrl != null + && repositoryUsername != null && repositoryPassword != null; // used to incrementally construct response as problems occur // (empty = no problems) @@ -410,8 +410,8 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase "curl", "--request", "DELETE", "--user", repositoryUsername + ":" + repositoryPassword, - (repositoryUrl + "/" + groupId.replace('.', '/') + "/" + - artifactId + "/" + version)) + repositoryUrl + "/" + groupId.replace('.', '/') + "/" + + artifactId + "/" + version) != 0) { logger.error @@ -437,13 +437,15 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase (dir, new SimpleFileVisitor() { + @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { // logger.info("RepositoryAudit: Delete " + file); file.toFile().delete(); - return(FileVisitResult.CONTINUE); + return FileVisitResult.CONTINUE; } + @Override public FileVisitResult postVisitDirectory(Path file, IOException e) throws IOException { @@ -451,11 +453,11 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase { // logger.info("RepositoryAudit: Delete " + file); file.toFile().delete(); - return(FileVisitResult.CONTINUE); + return FileVisitResult.CONTINUE; } else { - throw(e); + throw e; } } }); @@ -492,12 +494,12 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase if (process.waitFor(timeoutInSeconds, TimeUnit.SECONDS)) { // process terminated before the timeout - return(process.exitValue()); + return process.exitValue(); } // process timed out -- kill it, and return -1 process.destroyForcibly(); - return(-1); + return -1; } /* ============================================================ */ @@ -538,21 +540,22 @@ public class RepositoryAudit extends DroolsPDPIntegrityMonitor.AuditBase String[] segments = artifact.split("/"); if (segments.length != 4 && segments.length != 3) { - throw(new IllegalArgumentException("groupId/artifactId/version/type")); + throw new IllegalArgumentException("groupId/artifactId/version/type"); } groupId = segments[0]; artifactId = segments[1]; version = segments[2]; - type = (segments.length == 4 ? segments[3] : "jar"); + type = segments.length == 4 ? segments[3] : "jar"; } /** * @return the artifact id in the form: * "///" */ + @Override public String toString() { - return(groupId + "/" + artifactId + "/" + version + "/" + type); + return groupId + "/" + artifactId + "/" + version + "/" + type; } } } diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java index c8e17ea9..f90f7482 100644 --- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java +++ b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java @@ -38,6 +38,9 @@ public class StateManagementProperties { public static final String DB_PWD = "javax.persistence.jdbc.password"; private static Properties properties = null; + + private StateManagementProperties(){ + } /* * Initialize the parameter values from the feature-state-management.properties file values * -- cgit 1.2.3-korg