aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-28 08:27:20 +0530
committerIndrijeet Kumar <indriku1@in.ibm.com>2020-05-28 04:12:37 +0000
commitef85885428fc2d352e5171a98f6edc321dcdaaee (patch)
tree33595b3060b6c4a3e1ab5c769a952e30d79ebdf7
parentd99c6d9edac3ac8b5e9ba7284fbc65f40f02b97d (diff)
lowered some code smells
lowered some code smells Issue-ID: PORTAL-869 Change-Id: I38a7c71f67b05bea076c6a0912712097da2093c7 Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
-rw-r--r--music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java6
-rw-r--r--music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java2
-rw-r--r--music-core/src/main/java/org/onap/music/lockingservice/cassandra/LockCleanUpDaemon.java2
-rw-r--r--music-core/src/main/java/org/onap/music/lockingservice/cassandra/MusicLockState.java7
-rw-r--r--music-core/src/main/java/org/onap/music/main/CipherUtil.java3
5 files changed, 9 insertions, 11 deletions
diff --git a/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java b/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
index cd767a44..29fdb1d4 100644
--- a/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
+++ b/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
@@ -190,7 +190,6 @@ public class JsonUpdate implements Serializable {
}
EELFLoggerDelegate.mdcPut("keyspace", "( "+this.getKeyspaceName()+" ) ");
- long startTime = System.currentTimeMillis();
String operationId = UUID.randomUUID().toString(); // just for infoging purposes.
String consistency = this.getConsistencyInfo().get("type");
@@ -311,9 +310,6 @@ public class JsonUpdate implements Serializable {
conditionInfo = new Condition(this.getConditions(), selectQuery);
}
- ReturnType operationResult = null;
- long jsonParseCompletionTime = System.currentTimeMillis();
-
if(consistency.equalsIgnoreCase(MusicUtil.EVENTUAL) && this.getConsistencyInfo().get("consistency") != null) {
if(MusicUtil.isValidConsistency(this.getConsistencyInfo().get("consistency"))) {
queryObject.setConsistency(this.getConsistencyInfo().get("consistency"));
@@ -376,7 +372,7 @@ public class JsonUpdate implements Serializable {
}
public String getRowIdString() {
- return this.rowIdString.toString();
+ return this.rowIdString;
}
public void setRowIdString(String rowIdString) {
diff --git a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java
index 0c5d39c8..9a69a9ba 100644
--- a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java
+++ b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java
@@ -503,7 +503,7 @@ public class CassaLockStore {
}
public List<String> getAllLocksForOwner(String ownerId, String keyspace, String table) throws MusicServiceException, MusicQueryException {
- List<String> toRet = new ArrayList<String>();
+ List<String> toRet = new ArrayList<>();
String lockTable = table_prepend_name + table;
PreparedQueryObject queryObject = new PreparedQueryObject();
queryObject.appendQueryString("SELECT key, lockreference FROM " + keyspace + "." + lockTable);
diff --git a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/LockCleanUpDaemon.java b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/LockCleanUpDaemon.java
index 492a48f0..1f40f2bd 100644
--- a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/LockCleanUpDaemon.java
+++ b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/LockCleanUpDaemon.java
@@ -23,12 +23,10 @@
package org.onap.music.lockingservice.cassandra;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.onap.music.datastore.MusicDataStoreHandle;
import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
-import org.onap.music.exceptions.MusicQueryException;
import org.onap.music.exceptions.MusicServiceException;
import org.onap.music.main.MusicCore;
import org.onap.music.main.MusicUtil;
diff --git a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/MusicLockState.java b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/MusicLockState.java
index 00187dc8..14fb8135 100644
--- a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/MusicLockState.java
+++ b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/MusicLockState.java
@@ -39,15 +39,18 @@ import org.onap.music.eelf.logging.format.ErrorTypes;
// the state variable that will be stored in the locking service, capturing the transitions of
public class MusicLockState implements Serializable {
+ // captures the state of the lock
public enum LockStatus {
UNLOCKED, BEING_LOCKED, LOCKED
- };// captures the state of the lock
+ }
+
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicLockState.class);
private LockStatus lockStatus;
private boolean needToSyncQuorum = false;
private String lockHolder;
- private long leasePeriod = Long.MAX_VALUE, leaseStartTime = -1;
+ private long leasePeriod = Long.MAX_VALUE;
+ private long leaseStartTime = -1;
private String errorMessage = null;
public MusicLockState(String errorMessage) {
diff --git a/music-core/src/main/java/org/onap/music/main/CipherUtil.java b/music-core/src/main/java/org/onap/music/main/CipherUtil.java
index 3278dc12..9a8ff69d 100644
--- a/music-core/src/main/java/org/onap/music/main/CipherUtil.java
+++ b/music-core/src/main/java/org/onap/music/main/CipherUtil.java
@@ -168,7 +168,8 @@ public class CipherUtil {
*/
public static String encryptPKC(String value, String skey) {
Cipher cipher = null;
- byte[] iv = null, finalByte = null;
+ byte[] iv = null;
+ byte[] finalByte = null;
try {
cipher = Cipher.getInstance(ALGORYTHM_DETAILS, "SunJCE");