summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrama-huawei <rama.subba.reddy.s@huawei.com>2017-09-21 18:20:13 +0530
committerRama SubbaReddy <rama.subba.reddy.s@huawei.com>2017-09-21 12:54:28 +0000
commit699e40b32ad965d63c61a1602f56a54d30940e4e (patch)
tree9597addc0dee60dad6d319181f60616653f223eb
parent5a8fe222ebc4485fae7e78be8e9926d6e51ac93a (diff)
Removed useless parentheses
Added diamond symbol on RHS Issue-ID: POLICY-239 Change-Id: I24c138703047308c2e28fef2180a0bb64400c1c9 Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPDPIntegrityMonitor.java52
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java29
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java3
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerFactory.java8
4 files changed, 49 insertions, 43 deletions
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<Path>()
{
+ @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:
* "<groupId>/<artifactId>/<version>/<type>"
*/
+ @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
*
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerFactory.java
index 34c8589f..d0b625d7 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerFactory.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerFactory.java
@@ -190,13 +190,13 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
* Policy Controller Name Index
*/
protected HashMap<String,PolicyController> policyControllers =
- new HashMap<String,PolicyController>();
+ new HashMap<>();
/**
* Group/Artifact Ids Index
*/
protected HashMap<String,PolicyController> coordinates2Controller =
- new HashMap<String,PolicyController>();
+ new HashMap<>();
/**
* produces key for indexing controller names
@@ -479,7 +479,7 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
@Override
public List<PolicyController> inventory() {
List<PolicyController> controllers =
- new ArrayList<PolicyController>(this.policyControllers.values());
+ new ArrayList<>(this.policyControllers.values());
return controllers;
}
@@ -488,7 +488,7 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
*/
@Override
public List<String> getFeatures() {
- List<String> features = new ArrayList<String>();
+ List<String> features = new ArrayList<>();
for (PolicyControllerFeatureAPI feature : PolicyControllerFeatureAPI.providers.getList()) {
features.add(feature.getName());
}