Merge "Fix Blocker/Critical sonar issues"
diff --git a/dblib/features/pom.xml b/dblib/features/pom.xml
index 2be6c8d..4053efa 100755
--- a/dblib/features/pom.xml
+++ b/dblib/features/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>dblib</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>dblib-features</artifactId>
<name>DBLIB Adaptor - Features</name>
diff --git a/dblib/installer/pom.xml b/dblib/installer/pom.xml
index 10845db..a2d7362 100755
--- a/dblib/installer/pom.xml
+++ b/dblib/installer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>dblib</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>dblib-installer</artifactId>
<name>DBLIB Adaptor - Karaf Installer</name>
diff --git a/dblib/pom.xml b/dblib/pom.xml
index 9e15163..8e7afab 100755
--- a/dblib/pom.xml
+++ b/dblib/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
@@ -16,7 +16,7 @@
<name>DBLIB Adaptor</name>
<description>The DBLIB adaptor allows service logic to access persistent data in a local sql database</description>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
<build>
diff --git a/dblib/provider/pom.xml b/dblib/provider/pom.xml
index 11e0ff7..07fc61a 100755
--- a/dblib/provider/pom.xml
+++ b/dblib/provider/pom.xml
@@ -4,10 +4,10 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>dblib</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>dblib-provider</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>DBLIB Adaptor - Provider</name>
<url>http://maven.apache.org</url>
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
index 9dc262d..ee8ab2f 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
@@ -20,6 +20,18 @@
package org.onap.ccsdk.sli.core.dblib;
+import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException;
+import org.apache.tomcat.jdbc.pool.PoolExhaustedException;
+import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
+import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor;
+import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject;
+import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.sql.DataSource;
+import javax.sql.rowset.CachedRowSet;
+import javax.sql.rowset.RowSetProvider;
import java.io.Closeable;
import java.io.IOException;
import java.io.PrintWriter;
@@ -36,20 +48,6 @@
import java.util.Arrays;
import java.util.Observer;
-import javax.sql.DataSource;
-import javax.sql.rowset.CachedRowSet;
-import javax.sql.rowset.RowSetProvider;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.tomcat.jdbc.pool.PoolExhaustedException;
-import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
-import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor;
-import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver;
-import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject;
-
-import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException;
-
/**
* @version $Revision: 1.13 $
@@ -94,12 +92,14 @@
/* (non-Javadoc)
* @see javax.sql.DataSource#getConnection()
*/
+ @Override
public Connection getConnection() throws SQLException
{
return ds.getConnection();
}
- public CachedRowSet getData(String statement, ArrayList<Object> arguments) throws SQLException, Throwable
+ public CachedRowSet getData(String statement, ArrayList<Object> arguments)
+ throws SQLException, Throwable
{
TestObject testObject = null;
testObject = monitor.registerRequest();
@@ -128,7 +128,8 @@
}
}
- public boolean writeData(String statement, ArrayList<Object> arguments) throws SQLException, Throwable
+ public boolean writeData(String statement, ArrayList<Object> arguments)
+ throws SQLException, Throwable
{
TestObject testObject = null;
testObject = monitor.registerRequest();
@@ -157,7 +158,8 @@
}
}
- CachedRowSet executePreparedStatement(Connection conn, String statement, ArrayList<Object> arguments, boolean close) throws SQLException, Throwable
+ CachedRowSet executePreparedStatement(Connection conn, String statement,
+ ArrayList<Object> arguments, boolean close) throws SQLException, Throwable
{
long time = System.currentTimeMillis();
@@ -170,9 +172,10 @@
}
ResultSet rs = null;
+ PreparedStatement ps = null;
try {
data = RowSetProvider.newFactory().createCachedRowSet();
- PreparedStatement ps = conn.prepareStatement(statement);
+ ps = conn.prepareStatement(statement);
if(arguments != null)
{
for(int i = 0, max = arguments.size(); i < max; i++){
@@ -223,6 +226,13 @@
} catch(Exception exc){
}
+ try {
+ if (ps != null){
+ ps.close();
+ }
+ } catch (Exception exc){
+
+ }
}
return data;
@@ -298,6 +308,7 @@
/* (non-Javadoc)
* @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
*/
+ @Override
public Connection getConnection(String username, String password)
throws SQLException
{
@@ -307,6 +318,7 @@
/* (non-Javadoc)
* @see javax.sql.DataSource#getLogWriter()
*/
+ @Override
public PrintWriter getLogWriter() throws SQLException
{
return ds.getLogWriter();
@@ -315,6 +327,7 @@
/* (non-Javadoc)
* @see javax.sql.DataSource#getLoginTimeout()
*/
+ @Override
public int getLoginTimeout() throws SQLException
{
return ds.getLoginTimeout();
@@ -323,6 +336,7 @@
/* (non-Javadoc)
* @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
*/
+ @Override
public void setLogWriter(PrintWriter out) throws SQLException
{
ds.setLogWriter(out);
@@ -331,12 +345,14 @@
/* (non-Javadoc)
* @see javax.sql.DataSource#setLoginTimeout(int)
*/
+ @Override
public void setLoginTimeout(int seconds) throws SQLException
{
ds.setLoginTimeout(seconds);
}
+ @Override
public final String getDbConnectionName(){
return connectionName;
}
@@ -420,10 +436,12 @@
return true;
}
+ @Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
+ @Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return null;
}
@@ -447,34 +465,42 @@
monitor.deleteObserver(observer);
}
+ @Override
public long getInterval() {
return interval;
}
+ @Override
public long getInitialDelay() {
return initialDelay;
}
+ @Override
public void setInterval(long value) {
interval = value;
}
+ @Override
public void setInitialDelay(long value) {
initialDelay = value;
}
+ @Override
public long getExpectedCompletionTime() {
return expectedCompletionTime;
}
+ @Override
public void setExpectedCompletionTime(long value) {
expectedCompletionTime = value;
}
+ @Override
public long getUnprocessedFailoverThreshold() {
return unprocessedFailoverThreshold;
}
+ @Override
public void setUnprocessedFailoverThreshold(long value) {
this.unprocessedFailoverThreshold = value;
}
@@ -487,6 +513,7 @@
canTakeOffLine = false;
final Thread offLineTimer = new Thread()
{
+ @Override
public void run(){
try {
Thread.sleep(30000L);
@@ -565,7 +592,9 @@
retValue = false;
} finally {
try {
- lock.close();
+ if (lock != null) {
+ lock.close();
+ }
} catch(Exception exc) {
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java
index 07e3dfa..296fe70 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java
@@ -24,7 +24,6 @@
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.onap.ccsdk.sli.core.dblib.jdbc.JdbcDBCachedDataSource;
-import org.onap.ccsdk.sli.core.dblib.jdbc.MySQLCachedDataSource;
/**
* @version $Revision: 1.1 $
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java
index 201cc40..062cd84 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java
@@ -20,11 +20,8 @@
package org.onap.ccsdk.sli.core.dblib;
-import com.google.common.annotations.VisibleForTesting;
-
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
import java.util.Properties;
@@ -35,10 +32,6 @@
import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibJREFileResolver;
import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibKarafRootFileResolver;
import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibPropertiesFileResolver;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -146,7 +139,6 @@
* <li>A <code>dblib.properties</code> file located in the karaf root directory</li>
* </ol>
*/
- @VisibleForTesting
File determinePropertiesFile(final DBLIBResourceProvider dblibResourceProvider) {
for (final DblibPropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) {
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java
index 8181b13..40d1a23 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java
@@ -43,7 +43,6 @@
import javax.sql.rowset.CachedRowSet;
import org.apache.tomcat.jdbc.pool.PooledConnection;
-import org.apache.tomcat.jdbc.pool.ProxyConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,7 +64,8 @@
public boolean lockTable(String tablename) {
this.tableName = tablename;
- return locked = dataSource.lockTable(connection, tableName);
+ locked = dataSource.lockTable(connection, tableName);
+ return locked;
}
public void resetInactivityTimer() {
@@ -80,12 +80,13 @@
public boolean unlock() {
dataSource.unlockTable(connection);
- return locked = false;
+ locked = false;
+ return locked;
}
public boolean writeData(String statement, ArrayList<String> arguments) throws SQLException, Throwable
{
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
@@ -95,7 +96,7 @@
public CachedRowSet getData(String statement, ArrayList<String> arguments) throws SQLException, Throwable
{
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java
index 46c003a..ac67c3f 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java
@@ -38,9 +38,7 @@
import java.util.Properties;
import java.util.Queue;
import java.util.Set;
-import java.util.Timer;
import java.util.TimerTask;
-import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.sql.DataSource;
@@ -76,23 +74,22 @@
protected final AtomicBoolean dsSelector = new AtomicBoolean();
// Queue<CachedDataSource> dsQueue = new ConcurrentLinkedQueue<CachedDataSource>();
- Queue<CachedDataSource> dsQueue = new PriorityQueue<CachedDataSource>(4, new Comparator<CachedDataSource>(){
-
+ Queue<CachedDataSource> dsQueue = new PriorityQueue<>(4, new Comparator<CachedDataSource>() {
@Override
public int compare(CachedDataSource left, CachedDataSource right) {
try {
- if(!left.isSlave())
+ if (!left.isSlave()) {
return -1;
- if(!right.isSlave())
+ }
+ if (!right.isSlave()) {
return 1;
-
+ }
} catch (Throwable e) {
LOGGER.warn("", e);
}
return 0;
}
-
- });
+ });
protected final Set<CachedDataSource> broken = Collections.synchronizedSet(new HashSet<CachedDataSource>());
protected final Object monitor = new Object();
protected final Properties configProps;
@@ -240,6 +237,7 @@
class RecoveryMgr extends Thread {
+ @Override
public void run() {
while(!terminating)
{
@@ -295,7 +293,7 @@
*/
@Override
public CachedRowSet getData(String statement, ArrayList<String> arguments, String preferredDS) throws SQLException {
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
@@ -310,7 +308,7 @@
CachedDataSource active = null;
// test if there are any connection pools available
- LinkedList<CachedDataSource> sources = new LinkedList<CachedDataSource>(this.dsQueue);
+ LinkedList<CachedDataSource> sources = new LinkedList<>(this.dsQueue);
if(sources.isEmpty()){
LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available.");
throw new DBLibException("No active DB connection pools are available in RequestDataWithRecovery call.");
@@ -356,7 +354,7 @@
handleGetConnectionException(active, exc);
} finally {
if(LOGGER.isDebugEnabled()){
- time = (System.currentTimeMillis() - time);
+ time = System.currentTimeMillis() - time;
LOGGER.debug("getData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
}
}
@@ -410,7 +408,7 @@
}
} finally {
if(LOGGER.isDebugEnabled()){
- time = (System.currentTimeMillis() - time);
+ time = System.currentTimeMillis() - time;
LOGGER.debug(">> getData : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
}
}
@@ -423,7 +421,7 @@
@Override
public boolean writeData(String statement, ArrayList<String> arguments, String preferredDS) throws SQLException
{
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
@@ -498,7 +496,7 @@
}
} finally {
if(LOGGER.isDebugEnabled()){
- time = (System.currentTimeMillis() - time);
+ time = System.currentTimeMillis() - time;
LOGGER.debug("writeData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
}
}
@@ -710,7 +708,7 @@
public String getDBStatus(boolean htmlFormat) {
StringBuilder buffer = new StringBuilder();
- ArrayList<CachedDataSource> list = new ArrayList<CachedDataSource>();
+ ArrayList<CachedDataSource> list = new ArrayList<>();
list.addAll(dsQueue);
list.addAll(broken);
if (htmlFormat)
@@ -795,7 +793,7 @@
public String getPreferredDataSourceName(AtomicBoolean flipper) {
- LinkedList<CachedDataSource> snapshot = new LinkedList<CachedDataSource>(dsQueue);
+ LinkedList<CachedDataSource> snapshot = new LinkedList<>(dsQueue);
if(snapshot.size() > 1){
CachedDataSource first = snapshot.getFirst();
CachedDataSource last = snapshot.getLast();
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java
index de98466..0dea664 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.ccsdk.sli.core.dblib;
+import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -43,4 +44,6 @@
public abstract boolean isActive();
+ public abstract Connection getConnection() throws SQLException;
+
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java
index 127e6d3..b4d1ef6 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java
@@ -33,38 +33,47 @@
super(jdbcElem);
}
+ @Override
protected void configure(BaseDBConfiguration jdbcElem) throws DBConfigException {
// no action
}
+ @Override
public long getInterval() {
return 1000;
}
+ @Override
public long getInitialDelay() {
return 1000;
}
+ @Override
public long getExpectedCompletionTime() {
return 50;
}
+ @Override
public void setExpectedCompletionTime(long value) {
}
+ @Override
public void setInterval(long value) {
}
+ @Override
public void setInitialDelay(long value) {
}
+ @Override
public long getUnprocessedFailoverThreshold() {
return 3;
}
+ @Override
public void setUnprocessedFailoverThreshold(long value) {
}
@@ -74,6 +83,7 @@
return 0;
}
+ @Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
// TODO Auto-generated method stub
return null;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
index c024d00..ffe8344 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
@@ -30,7 +30,6 @@
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.DBConfigException;
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
-import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java
index 978de0e..803e6b3 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java
@@ -22,9 +22,7 @@
import java.sql.SQLException;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -35,7 +33,6 @@
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.CachedDataSourceFactory;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
-import org.onap.ccsdk.sli.core.dblib.DataSourceComparator;
import org.onap.ccsdk.sli.core.dblib.config.DbConfigPool;
import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.onap.ccsdk.sli.core.dblib.factory.AbstractResourceManagerFactory;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java
index 4072098..bea0d63 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java
@@ -26,7 +26,6 @@
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.DBConfigException;
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
-import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java
index 17c42ec..0b69109 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver;
import com.google.common.base.Strings;
+
import java.io.File;
import java.nio.file.Paths;
import java.util.Optional;
diff --git a/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java b/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java
index 117492d..65ebfba 100644
--- a/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java
+++ b/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java
@@ -2,8 +2,6 @@
import static org.junit.Assert.*;
-import java.io.File;
-import java.util.Optional;
import org.junit.Test;
public class DblibJREFileResolverTest {
diff --git a/filters/features/pom.xml b/filters/features/pom.xml
index 0d71e91..95ccdfc 100755
--- a/filters/features/pom.xml
+++ b/filters/features/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>filters</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>filters-features</artifactId>
<name>Filters - Features</name>
diff --git a/filters/installer/pom.xml b/filters/installer/pom.xml
index 1e839d9..e2eb430 100755
--- a/filters/installer/pom.xml
+++ b/filters/installer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>filters</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>filters-installer</artifactId>
<name>Filters - Karaf Installer</name>
diff --git a/filters/pom.xml b/filters/pom.xml
index 2e159c4..f79787e 100644
--- a/filters/pom.xml
+++ b/filters/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -16,7 +16,7 @@
<name>Filters</name>
<description>Servlet filter to implement ECOMP logging spec</description>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
diff --git a/filters/provider/pom.xml b/filters/provider/pom.xml
index 240966e..a590719 100755
--- a/filters/provider/pom.xml
+++ b/filters/provider/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>filters</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>filters-provider</artifactId>
<packaging>bundle</packaging>
diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java
index 4b14b21..abbb7c6 100644
--- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java
+++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java
@@ -144,7 +144,7 @@
String authzHeader = request.getHeader("Authorization");
String usernameAndPassword = new String(Base64.decodeBase64(authzHeader.substring(6).getBytes()));
- int userNameIndex = usernameAndPassword.indexOf(":");
+ int userNameIndex = usernameAndPassword.indexOf(':');
String username = usernameAndPassword.substring(0, userNameIndex);
userName = username;
@@ -171,7 +171,7 @@
MDC.put(END_TIMESTAMP,asIso8601(System.currentTimeMillis()));
//MDC.put(REQUEST_ID,"already done above");
MDC.put(SERVICE_NAME,request.getRequestURL().toString());
- int idx = request.getPathInfo().toString().lastIndexOf(":");
+ int idx = request.getPathInfo().lastIndexOf(':');
String instance = "";
if ( idx != -1 ) {
instance = request.getPathInfo().substring(idx+1);
@@ -186,13 +186,13 @@
MDC.put(STATUS_CODE,"COMPLETE");
}
- MDC.put(RESP_CODE,"" + response.getStatus());
+ MDC.put(RESP_CODE, Integer.toString(response.getStatus()));
MDC.put(RESP_DESC,"");
MDC.put(INSTANCE_UUID,"");
MDC.put(CATEGORY,"");
MDC.put(SEVERITY,"");
//MDC.put(SERVER_IP,""); //by chef
- MDC.put(ELAPSED_TIME,"" + (System.currentTimeMillis() - startTime));
+ MDC.put(ELAPSED_TIME,Long.toString(System.currentTimeMillis() - startTime));
//MDC.put(SERVER_HOST,""); //by chef
MDC.put(CLIENT_IP,request.getRemoteHost());
MDC.put(CLASS,"");
diff --git a/pom.xml b/pom.xml
index eba735f..3bf8b1e 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <name>CCSDK Core Components</name>
+ <name>ccsdk-sli-core</name>
<url>https://wiki.onap.org</url>
<description>CCSDK core components contains the SLI, dblib</description>
@@ -128,7 +128,7 @@
<organization>
<name>ONAP</name>
</organization>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</project>
diff --git a/sli/common/pom.xml b/sli/common/pom.xml
index 52bfd53..f71ca35 100755
--- a/sli/common/pom.xml
+++ b/sli/common/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>sli</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sli-common</artifactId>
<packaging>bundle</packaging>
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java
index 699ace2..5e19a52 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java
@@ -21,10 +21,6 @@
package org.onap.ccsdk.sli.core.sli;
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
public class SvcLogicAtom extends SvcLogicExpression {
public enum AtomType {
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
index 9216519..712c64a 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
@@ -145,7 +145,7 @@
try {
- dbConn = ((DBResourceManager) dbSvc).getConnection();
+ dbConn = dbSvc.getConnection();
ArrayList<String> args = new ArrayList<String>();
@@ -276,7 +276,7 @@
Connection dbConn = null;
PreparedStatement storeGraphStmt = null;
try {
- dbConn = ((DBResourceManager) dbSvc).getConnection();
+ dbConn = dbSvc.getConnection();
boolean oldAutoCommit = dbConn.getAutoCommit();
dbConn.setAutoCommit(false);
storeGraphStmt = dbConn
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java
index b8a47c4..26783e7 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java
@@ -22,7 +22,6 @@
package org.onap.ccsdk.sli.core.sli;
import java.io.Serializable;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java
index 4512775..23dff3e 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java
@@ -21,14 +21,10 @@
package org.onap.ccsdk.sli.core.sli;
-import java.util.Map;
-
+/**
+ * A marker interface, used to indicate that a class exposes methods that can be
+ * called from an <execute> node. Such methods must have the signature:
+ * void methodName(Map, SvcLogicContext)
+ */
public interface SvcLogicJavaPlugin {
-
- /**
- * A marker interface, used to indicate that a class exposes methods that can be
- * called from an <execute> node. Such methods must have the signature:
- * void methodName(Map, SvcLogicContext)
- */
-
}
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java
index 56ed530..160107f 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java
@@ -36,8 +36,6 @@
import org.apache.commons.lang3.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.xml.sax.Locator;
-
public class SvcLogicNode implements Serializable {
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java
index 40295bd..0e2c425 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java
@@ -21,7 +21,6 @@
package org.onap.ccsdk.sli.core.sli;
-import java.sql.SQLException;
import java.util.Map;
public interface SvcLogicResource {
diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java
index ec18b87..0e6000f 100644
--- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java
+++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java
@@ -28,12 +28,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
-import java.util.LinkedList;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
-import org.onap.ccsdk.sli.core.sli.SvcLogicParserException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
-import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
import junit.framework.TestCase;
diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java
index 60d7046..3b9fff7 100644
--- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java
+++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java
@@ -21,17 +21,13 @@
package org.onap.ccsdk.sli.core.sli;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java
index 125ac56..80df10c 100644
--- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java
+++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java
@@ -25,9 +25,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
-import org.onap.ccsdk.sli.core.sli.SvcLogicExprListener;
-import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
-import org.onap.ccsdk.sli.core.sli.SvcLogicExpressionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sli/features/pom.xml b/sli/features/pom.xml
index 975839f..dc7a95d 100755
--- a/sli/features/pom.xml
+++ b/sli/features/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sli</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sli-features</artifactId>
<name>SLI - Features</name>
diff --git a/sli/installer/pom.xml b/sli/installer/pom.xml
index 0319f5b..0eec332 100755
--- a/sli/installer/pom.xml
+++ b/sli/installer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sli</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sli-installer</artifactId>
<name>SLI - Karaf Installer</name>
diff --git a/sli/pom.xml b/sli/pom.xml
index b8ce1e3..7257e9e 100755
--- a/sli/pom.xml
+++ b/sli/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
@@ -59,7 +59,7 @@
<organization>
<name>ONAP</name>
</organization>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</project>
diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml
index 5ef47ef..f665c56 100755
--- a/sli/provider/pom.xml
+++ b/sli/provider/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sli-provider</artifactId>
<packaging>bundle</packaging>
diff --git a/sli/recording/pom.xml b/sli/recording/pom.xml
index 932e3cc..97c9918 100755
--- a/sli/recording/pom.xml
+++ b/sli/recording/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sli-recording</artifactId>
<packaging>bundle</packaging>
diff --git a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java
index 9228d15..fd857f5 100644
--- a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java
+++ b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java
@@ -33,7 +33,7 @@
public class RecordingActivator implements BundleActivator {
- private LinkedList<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+ private LinkedList<ServiceRegistration> registrations = new LinkedList<>();
private static final Logger LOG = LoggerFactory
.getLogger(RecordingActivator.class);
@@ -43,7 +43,7 @@
if (registrations == null)
{
- registrations = new LinkedList<ServiceRegistration>();
+ registrations = new LinkedList<>();
}
diff --git a/sliPluginUtils/features/pom.xml b/sliPluginUtils/features/pom.xml
index ce87536..41381b6 100755
--- a/sliPluginUtils/features/pom.xml
+++ b/sliPluginUtils/features/pom.xml
@@ -8,7 +8,7 @@
<parent>
<artifactId>sliPluginUtils</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<name>SliPluginUtils Plugin - Features</name>
diff --git a/sliPluginUtils/installer/pom.xml b/sliPluginUtils/installer/pom.xml
index a92c9cd..dd904e4 100755
--- a/sliPluginUtils/installer/pom.xml
+++ b/sliPluginUtils/installer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sliPluginUtils</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sliPluginUtils-installer</artifactId>
<name>SLI Plugin Utilities - Karaf Installer</name>
diff --git a/sliPluginUtils/pom.xml b/sliPluginUtils/pom.xml
index 5e084af..3d80b72 100755
--- a/sliPluginUtils/pom.xml
+++ b/sliPluginUtils/pom.xml
@@ -3,7 +3,7 @@
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
@@ -11,7 +11,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<name>Service Logic Interface Plugin Utilities</name>
<description>A package of static utility functions to be used when developing SLI plugins</description>
diff --git a/sliPluginUtils/provider/pom.xml b/sliPluginUtils/provider/pom.xml
index 430221f..ad950c0 100755
--- a/sliPluginUtils/provider/pom.xml
+++ b/sliPluginUtils/provider/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<name>SliPluginUtils Plugin - Provider</name>
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java
index 326490d..6bdd87e 100644
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java
@@ -124,7 +124,7 @@
sb.append("&dme2.partner=" + this.partner);
}
sb.append("&dme2.allowhttpcode=true");
- return (sb.toString());
+ return sb.toString();
}
public synchronized String acquireHostName() {
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
index e6811e7..3237586 100644
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
@@ -26,6 +26,7 @@
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -137,7 +138,7 @@
// Obtain key-value pairs to check from parameters
LOG.trace("reading keys parameter list");
- HashMap<String,String> keys_values = new HashMap<String,String>();
+ HashMap<String,String> keys_values = new HashMap<>();
for( int i = 0; i < keys_length; i++ ) {
keys_values.put(parameters.get("keys[" + i + "].key"), parameters.get("keys[" + i + "].value"));
}
@@ -173,7 +174,7 @@
*/
public void ctxSortList( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
checkParameters(parameters, new String[]{"list","delimiter"}, LOG);
- ArrayList<SortableCtxListElement> list = new ArrayList<SortableCtxListElement>();
+ ArrayList<SortableCtxListElement> list = new ArrayList<>();
String[] sort_fields = null;
if( parameters.containsKey("sort-fields") ) {
@@ -204,7 +205,7 @@
i++;
}
// Reset list length (removed by ctxBulkErase above)
- ctx.setAttribute(ctx_list_str+"_length", ""+listSz);
+ ctx.setAttribute(ctx_list_str+"_length", Integer.toString(listSz));
}
/**
@@ -283,7 +284,7 @@
log.debug("required parameters was empty, exiting early.");
return;
}
- if (parametersMap == null || parametersMap.keySet().size() < 1){
+ if (parametersMap == null || parametersMap.keySet().isEmpty()){
String errorMessage = "This method requires the parameters [" + StringUtils.join(requiredParams,",") + "], but no parameters were passed in.";
log.error(errorMessage);
throw new SvcLogicException(errorMessage);
@@ -306,7 +307,7 @@
* @since 1.0
*/
public static final void ctxBulkErase( SvcLogicContext ctx, String pfx ) {
- ArrayList<String> Keys = new ArrayList<String>( ctx.getAttributeKeySet() );
+ ArrayList<String> Keys = new ArrayList<>(ctx.getAttributeKeySet());
for( String key : Keys ) {
if( key.startsWith( pfx ) ) {
ctx.setAttribute( pfx + key.substring(pfx.length()) , null);
@@ -336,7 +337,7 @@
// For each context key that begins with src_pfx, set the value of the
// key dest_pfx + the suffix of the key to the key's value
- ArrayList<String> Keys = new ArrayList<String>(ctx.getAttributeKeySet());
+ ArrayList<String> Keys = new ArrayList<>(ctx.getAttributeKeySet());
for( String key : Keys ) {
if( key.startsWith(src_pfx) ) {
// Get suffix (no leading period)
@@ -360,7 +361,7 @@
* in ctx whose key begins with prefix.
*/
public static final Map<String, String> ctxGetBeginsWith( SvcLogicContext ctx, String prefix ) {
- Map<String, String> prefixMap = new HashMap<String, String>();
+ Map<String, String> prefixMap = new HashMap<>();
for( String key : ctx.getAttributeKeySet() ) {
if( key.startsWith(prefix) ) {
@@ -480,7 +481,7 @@
* @since 1.0
*/
public static final int getArrayLength( SvcLogicContext ctx, String key, Logger log, LogLevel logLevel, String log_message ) {
- String ctxKey = ( key.endsWith("_length") ) ? key : key + "_length";
+ String ctxKey = key.endsWith("_length") ? key : key + "_length";
try {
return Integer.parseInt(ctx.getAttribute(ctxKey));
}
@@ -489,6 +490,7 @@
switch( logLevel ) {
case TRACE:
log.trace(log_message);
+ break;
case DEBUG:
log.debug(log_message);
break;
@@ -523,7 +525,7 @@
logLevelIsEnabled( log, logLevel );
// Print sorted context memory key-value pairs to the log
- ArrayList<String> keys = new ArrayList<String>(ctx.getAttributeKeySet());
+ ArrayList<String> keys = new ArrayList<>(ctx.getAttributeKeySet());
Collections.sort(keys);
for( String key : keys ) {
logMessageAtLevel( log, logLevel, key + " = " + ctx.getAttribute(key) );
@@ -614,7 +616,7 @@
// ========== LOCAL CLASSES ==========
private class SortableCtxListElement implements Comparable<SortableCtxListElement> {
- HashMap<String,String> child_elements = new HashMap<String,String>();
+ HashMap<String,String> child_elements = new HashMap<>();
String[] sort_fields;
public SortableCtxListElement( SvcLogicContext ctx, String root, String[] sort_fields ) {
@@ -648,6 +650,38 @@
return 0;
}
+
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof SortableCtxListElement)) {
+ return false;
+ }
+ if (!super.equals(object)) {
+ return false;
+ }
+
+ SortableCtxListElement that = (SortableCtxListElement) object;
+
+ if (child_elements != null ? !child_elements.equals(that.child_elements)
+ : that.child_elements != null) {
+ return false;
+ }
+ // Probably incorrect - comparing Object[] arrays with Arrays.equals
+ if (!Arrays.equals(sort_fields, that.sort_fields)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (child_elements != null ? child_elements.hashCode() : 0);
+ result = 31 * result + Arrays.hashCode(sort_fields);
+ return result;
+ }
}
/**
@@ -695,7 +729,7 @@
* @since 11.0.2
*/
public static void requiredParameters(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
- if (parameters == null || parameters.keySet().size() < 1) {
+ if (parameters == null || parameters.keySet().isEmpty()) {
String errorMessage = "requiredParameters should not be called if the parameters hashmap is null or empty!";
LOG.error(errorMessage);
throw new SvcLogicException(errorMessage);
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java
index aa25fe3..32e1aeb 100644
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java
@@ -60,7 +60,7 @@
// Initialize list
int capacity = getCtxListLength(ctx, prefix);
- this.list = new ArrayList<HashMap<String, String>>(capacity);
+ this.list = new ArrayList<>(capacity);
for( int i = 0; i < capacity; i++ ) {
this.list.add(i, new HashMap<String,String>());
}
@@ -158,7 +158,7 @@
for( int i = 0; i < this.list.size(); i++ ) {
for( Map.Entry<String,String> entry : this.list.get(i).entrySet() ) {
- if( entry.getKey().equals("") ) {
+ if("".equals(entry.getKey())) {
ctx.setAttribute(prefix + '[' + i + ']', entry.getValue());
} else {
ctx.setAttribute(prefix + '[' + i + "]." + entry.getKey(), entry.getValue());
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
index 106b0cf..166a60e 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
@@ -27,7 +27,6 @@
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java
index a46c851..774aa1c 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java
@@ -32,7 +32,6 @@
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java
index ba7a766..f9d70f2 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java
@@ -30,7 +30,6 @@
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java
index 9768108..bf7cc13 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java
@@ -30,7 +30,6 @@
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java
index 09683ac..72b3264 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java
@@ -35,7 +35,6 @@
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils;
/**
* @author km991u
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java
index 263ba1f..f916bbf 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java
@@ -29,7 +29,6 @@
import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.slipluginutils.SvcLogicContextList;
public class SvcLogicContextListTest {
//private static final Logger LOG = LoggerFactory.getLogger(SvcLogicContextTest.class);
diff --git a/sliapi/features/pom.xml b/sliapi/features/pom.xml
index 531315e..caa6a8b 100755
--- a/sliapi/features/pom.xml
+++ b/sliapi/features/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sliapi</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sliapi-features</artifactId>
diff --git a/sliapi/installer/pom.xml b/sliapi/installer/pom.xml
index 2495205..dff580b 100755
--- a/sliapi/installer/pom.xml
+++ b/sliapi/installer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sliapi</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sliapi-installer</artifactId>
<packaging>pom</packaging>
diff --git a/sliapi/model/pom.xml b/sliapi/model/pom.xml
index 8fed200..fc9b763 100755
--- a/sliapi/model/pom.xml
+++ b/sliapi/model/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sliapi</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sliapi-model</artifactId>
<packaging>bundle</packaging>
diff --git a/sliapi/pom.xml b/sliapi/pom.xml
index 64f84b9..a58596a 100755
--- a/sliapi/pom.xml
+++ b/sliapi/pom.xml
@@ -6,13 +6,13 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliapi</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
<properties>
<feature-name>sliapi</feature-name>
diff --git a/sliapi/provider/pom.xml b/sliapi/provider/pom.xml
index e679f36..7e0bd26 100755
--- a/sliapi/provider/pom.xml
+++ b/sliapi/provider/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>sliapi</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>sliapi-provider</artifactId>
<packaging>bundle</packaging>