From aae956f3c892f3e3e85654df2a8c30570976fa3b Mon Sep 17 00:00:00 2001 From: shashikanth Date: Thu, 21 Sep 2017 11:25:49 +0530 Subject: [PATCH] Fix string literal comparision on left side Fix Major sonar issues in aai/aai-champ module https://sonar.onap.org/component_issues?id=org.openecomp.aai%3Achamp#resolved=false|severities=MAJOR Fixed issue Move string literal on the left side of this string comparison Issue-Id:AAI-246 Change-Id: I2c714ffca0933f5083e1f37d6ac70d79f018ecdc Signed-off-by: shashikanth.vh --- .../aai/champ/graph/impl/TitanChampGraphImpl.java | 63 +++++++++++----------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/openecomp/aai/champ/graph/impl/TitanChampGraphImpl.java b/src/main/java/org/openecomp/aai/champ/graph/impl/TitanChampGraphImpl.java index 2bb8d2e..d4f194a 100644 --- a/src/main/java/org/openecomp/aai/champ/graph/impl/TitanChampGraphImpl.java +++ b/src/main/java/org/openecomp/aai/champ/graph/impl/TitanChampGraphImpl.java @@ -21,19 +21,19 @@ */ package org.openecomp.aai.champ.graph.impl; -import java.time.temporal.ChronoUnit; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.Spliterator; -import java.util.Spliterators; -import java.util.concurrent.ExecutionException; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - +import com.thinkaurelius.titan.core.Cardinality; +import com.thinkaurelius.titan.core.EdgeLabel; +import com.thinkaurelius.titan.core.PropertyKey; +import com.thinkaurelius.titan.core.SchemaViolationException; +import com.thinkaurelius.titan.core.TitanEdge; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; +import com.thinkaurelius.titan.core.schema.SchemaAction; +import com.thinkaurelius.titan.core.schema.SchemaStatus; +import com.thinkaurelius.titan.core.schema.TitanGraphIndex; +import com.thinkaurelius.titan.core.schema.TitanManagement; +import com.thinkaurelius.titan.graphdb.database.management.ManagementSystem; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.aai.champ.ChampCapabilities; @@ -53,19 +53,18 @@ import org.openecomp.aai.champ.schema.DefaultChampSchemaEnforcer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.thinkaurelius.titan.core.Cardinality; -import com.thinkaurelius.titan.core.EdgeLabel; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.SchemaViolationException; -import com.thinkaurelius.titan.core.TitanEdge; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import com.thinkaurelius.titan.core.schema.SchemaAction; -import com.thinkaurelius.titan.core.schema.SchemaStatus; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; -import com.thinkaurelius.titan.graphdb.database.management.ManagementSystem; +import java.time.temporal.ChronoUnit; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.concurrent.ExecutionException; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { @@ -100,16 +99,14 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { final Object storageBackend = builder.graphConfiguration.get("storage.backend"); - if (storageBackend.equals("cassandra") || - storageBackend.equals("cassandrathrift") || - storageBackend.equals("astyanax") || - storageBackend.equals("embeddedcassandra")) { + if ("cassandra".equals(storageBackend) || "cassandrathrift".equals(storageBackend) + || "astyanax".equals(storageBackend) || "embeddedcassandra".equals(storageBackend)) { titanGraphBuilder.set(TITAN_CASSANDRA_KEYSPACE, builder.graphName); - } else if (storageBackend.equals("hbase")) { + } else if ("hbase".equals(storageBackend)) { titanGraphBuilder.set(TITAN_HBASE_TABLE, builder.graphName); - } else if (storageBackend.equals("berkleyje")) { + } else if ("berkleyje".equals(storageBackend)) { throw new RuntimeException("storage.backend=berkleyje cannot handle multiple graphs on a single DB, not usable"); - } else if (storageBackend.equals("inmemory")) { + } else if ("inmemory".equals(storageBackend)) { } else { throw new RuntimeException("Unknown storage.backend=" + storageBackend); } -- 2.16.6