diff options
author | vasraz <vasyl.razinkov@est.tech> | 2019-11-20 17:32:02 +0000 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2019-11-25 08:21:43 +0000 |
commit | 60be4e21f1ada02fbbdb39cc47ff1c69c098a00a (patch) | |
tree | 8d05c95e8b856255564fd6f9f1e1c096f77b5567 /catalog-dao/src/main/java/org | |
parent | fe540e1d6e3f0155741a4b4bc48f5ec56f114852 (diff) |
Fix Sonar issue
Major SmellCode:
Replace StringBuffer with StringBuilder
Change-Id: I0283e5160e5c1f23423c66110015f18c8163411e
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-2670
Diffstat (limited to 'catalog-dao/src/main/java/org')
-rw-r--r-- | catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java | 20 | ||||
-rw-r--r-- | catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java index 591d7f32d7..f679a5c103 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java @@ -1246,16 +1246,16 @@ public class JanusGraphGenericDao { public JanusGraphOperationStatus lockElement(String id, NodeTypeEnum type) { - StringBuffer lockId = new StringBuffer(LOCK_NODE_PREFIX); + StringBuilder lockId = new StringBuilder(LOCK_NODE_PREFIX); lockId.append(type.getName()).append("_").append(id); return lockNode(lockId.toString()); } public JanusGraphOperationStatus lockElement(GraphNode node) { - StringBuffer lockId = createLockElementId(node); + String lockId = createLockElementId(node); - return lockNode(lockId.toString()); + return lockNode(lockId); } private JanusGraphOperationStatus lockNode(String lockId) { @@ -1416,12 +1416,12 @@ public class JanusGraphGenericDao { * @return */ public JanusGraphOperationStatus releaseElement(GraphNode node) { - StringBuffer lockId = createLockElementId(node); + String lockId = createLockElementId(node); return unlockNode(lockId); } - private JanusGraphOperationStatus unlockNode(StringBuffer lockId) { + private JanusGraphOperationStatus unlockNode(String lockId) { GraphNodeLock lockNode = new GraphNodeLock(lockId.toString()); Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew = deleteNode(lockNode, GraphNodeLock.class); @@ -1437,15 +1437,15 @@ public class JanusGraphGenericDao { } public JanusGraphOperationStatus releaseElement(String id, NodeTypeEnum type) { - StringBuffer lockId = new StringBuffer(LOCK_NODE_PREFIX); + StringBuilder lockId = new StringBuilder(LOCK_NODE_PREFIX); lockId.append(type.getName()).append("_").append(id); - return unlockNode(lockId); + return unlockNode(lockId.toString()); } - private StringBuffer createLockElementId(GraphNode node) { - StringBuffer lockId = new StringBuffer(LOCK_NODE_PREFIX); + private String createLockElementId(GraphNode node) { + StringBuilder lockId = new StringBuilder(LOCK_NODE_PREFIX); lockId.append(node.getLabel()).append("_").append(node.getUniqueId()); - return lockId; + return lockId.toString(); } public <T extends GraphNode> Either<ImmutablePair<T, GraphEdge>, JanusGraphOperationStatus> getChild(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz) { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java index 2d2d9b8962..acd6969a71 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java @@ -28,7 +28,7 @@ public class IdBuilderUtils { private static String DOT = "."; public static String generateChildId(String componentId, VertexTypeEnum type){ - StringBuffer sb = new StringBuffer(componentId); + StringBuilder sb = new StringBuilder(componentId); sb.append(DOT).append(type.getName()); return sb.toString(); } |