aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-28 09:49:59 +0530
committerIndrijeet Kumar <indriku1@in.ibm.com>2020-05-28 04:19:58 +0000
commit91493bfcb6690ed0d3817670d9fa8c5c0022d613 (patch)
tree4c3394438ae196aa3dd082d85d32b429cbea3518
parentd99c6d9edac3ac8b5e9ba7284fbc65f40f02b97d (diff)
lowered some code smells
lowered some code smells Issue-ID: PORTAL-869 Change-Id: Ia92c254b9fb9ddfe9db63889808eea07557c198a Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
-rw-r--r--music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java7
-rw-r--r--music-core/src/main/java/org/onap/music/main/MusicUtil.java12
-rw-r--r--music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java3
3 files changed, 10 insertions, 12 deletions
diff --git a/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java b/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java
index 23ccca7f..004bd550 100644
--- a/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java
+++ b/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java
@@ -47,7 +47,7 @@ public class DeadlockDetectionUtil {
public Node(String id) {
super();
this.id = id;
- this.links = new ArrayList<Node>();
+ this.links = new ArrayList<>();
}
public List<Node> getLinks() {
@@ -85,7 +85,7 @@ public class DeadlockDetectionUtil {
}
public DeadlockDetectionUtil() {
- this.nodeList = new HashMap<String, Node>();
+ this.nodeList = new HashMap<>();
}
public void listAllNodes() {
@@ -105,8 +105,7 @@ public class DeadlockDetectionUtil {
currentNode = nodeList.get("o" + owner);
}
- boolean cycle = findCycle(currentNode);
- return cycle;
+ return findCycle(currentNode);
}
private boolean findCycle(Node currentNode) {
diff --git a/music-core/src/main/java/org/onap/music/main/MusicUtil.java b/music-core/src/main/java/org/onap/music/main/MusicUtil.java
index 865ca01f..4b8b1059 100644
--- a/music-core/src/main/java/org/onap/music/main/MusicUtil.java
+++ b/music-core/src/main/java/org/onap/music/main/MusicUtil.java
@@ -516,7 +516,7 @@ public class MusicUtil {
case MAP:
return (Map<String, Object>) valueObj;
case LIST:
- return (List<Object>)valueObj;
+ return valueObj;
case BLOB:
default:
@@ -525,8 +525,8 @@ public class MusicUtil {
}
public static ByteBuffer convertToActualDataType(DataType colType, byte[] valueObj) {
- ByteBuffer buffer = ByteBuffer.wrap(valueObj);
- return buffer;
+
+ return ByteBuffer.wrap(valueObj);
}
/**
@@ -620,11 +620,9 @@ public class MusicUtil {
* @throws MusicServiceException
* @throws MusicQueryException
*/
- public static long v2sTimeStampInMicroseconds(long ordinal, long timeOfWrite) throws MusicServiceException, MusicQueryException {
+ public static long v2sTimeStampInMicroseconds(long ordinal, long timeOfWrite) throws MusicServiceException, MusicQueryException{
// TODO: use acquire time instead of music eternity epoch
- long ts = ordinal * MaxLockReferenceTimePart + (timeOfWrite - MusicEternityEpochMillis);
-
- return ts;
+ return ordinal * MaxLockReferenceTimePart + (timeOfWrite - MusicEternityEpochMillis);
}
public static MusicCoreService getMusicCoreService() {
diff --git a/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java b/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
index d29ba32b..8055a48d 100644
--- a/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
+++ b/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
@@ -1080,9 +1080,10 @@ public class MusicCassaCore implements MusicCoreService {
ReturnType result = null;
try {
+
PreparedQueryObject queryObj = null;
queryObj = jsonInsertObj.genInsertPreparedQueryObj();
-
+
if (consistency.equalsIgnoreCase(MusicUtil.EVENTUAL)) {
result = eventualPut(jsonInsertObj.genInsertPreparedQueryObj());
} else if (consistency.equalsIgnoreCase(MusicUtil.CRITICAL)) {