Sonar fix NullPointerException 04/95304/5
authorArindam Mondal <arind.mondal@samsung.com>
Tue, 10 Sep 2019 06:02:53 +0000 (15:02 +0900)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Thu, 3 Oct 2019 13:57:18 +0000 (13:57 +0000)
Issue-ID: SDC-2542
Change-Id: I08a93932d2776c40a982bb802aeac994c1f35841
Signed-off-by: arindamm <arind.mondal@samsung.com>
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java

index 5917b14..7a8d1b7 100644 (file)
@@ -956,7 +956,7 @@ public class JanusGraphDao {
                     toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
             result = JanusGraphOperationStatus.NOT_FOUND;
         }
-        if (result == null) {
+        if (result == null && org.apache.commons.collections4.IteratorUtils.isEmpty(prevEdgeIter)) {
             result = replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
         }
         return result;
index 771620d..a0e6e7e 100644 (file)
@@ -560,7 +560,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
                 result = StorageOperationStatus.NOT_FOUND;
             }
         }
-        if (result == null) {
+        if (result == null && foundEdge!=null) {
             JanusGraphOperationStatus
                 createEdgeRes = janusGraphDao
                 .createEdge(foundEdge.outVertex(), certifiedToscaElement.getVertex(), EdgeLabelEnum.LAST_STATE, foundEdge);
index 3a48286..7d9d475 100644 (file)
@@ -179,16 +179,14 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
         } else if (!vendorName.equals(other.vendorName)) {
             return false;
         }
-        if (vendorRelease == null) {
-            if (other.vendorRelease != null) {
+        if (vendorRelease == null && other.vendorRelease != null) {
                 return false;
-            }
         }
         if (toscaResourceName == null) {
             if (other.toscaResourceName != null) {
                 return false;
             }
-        } else if (!vendorRelease.equals(other.vendorRelease)) {
+        } else if (vendorRelease!=null && !vendorRelease.equals(other.vendorRelease)) {
             return false;
         }
         if (resourceVendorModelNumber == null) {