Commit ee8c81df by David Radley Committed by Madhan Neethiraj

ATLAS-1912: fix for defects reported by Coverity scan

parent 1c4e8b7f
...@@ -100,6 +100,7 @@ public enum AtlasErrorCode { ...@@ -100,6 +100,7 @@ public enum AtlasErrorCode {
INSTANCE_NOT_FOUND(404, "ATLAS-404-00-00B", "Given instance is invalid/not found: {0}"), INSTANCE_NOT_FOUND(404, "ATLAS-404-00-00B", "Given instance is invalid/not found: {0}"),
RELATIONSHIP_GUID_NOT_FOUND(404, "ATLAS-404-00-00C", "Given relationship guid {0} is invalid/not found"), RELATIONSHIP_GUID_NOT_FOUND(404, "ATLAS-404-00-00C", "Given relationship guid {0} is invalid/not found"),
RELATIONSHIP_CRUD_INVALID_PARAMS(404, "ATLAS-404-00-00D", "Invalid relationship creation/updation parameters passed : {0}"), RELATIONSHIP_CRUD_INVALID_PARAMS(404, "ATLAS-404-00-00D", "Invalid relationship creation/updation parameters passed : {0}"),
RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND(404, "ATLAS-404-00-00E", "RelationshipDef {0} endDef typename {0} cannot be found"),
// All data conflict errors go here // All data conflict errors go here
TYPE_ALREADY_EXISTS(409, "ATLAS-409-00-001", "Given type {0} already exists"), TYPE_ALREADY_EXISTS(409, "ATLAS-409-00-001", "Given type {0} already exists"),
TYPE_HAS_REFERENCES(409, "ATLAS-409-00-002", "Given type {0} has references"), TYPE_HAS_REFERENCES(409, "ATLAS-409-00-002", "Given type {0} has references"),
......
...@@ -78,15 +78,23 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme ...@@ -78,15 +78,23 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
updateVertexPreCreate(relationshipDef, (AtlasRelationshipType) type, relationshipDefVertex); updateVertexPreCreate(relationshipDef, (AtlasRelationshipType) type, relationshipDefVertex);
final AtlasRelationshipEndDef endDef1 = relationshipDef.getEndDef1(); final AtlasRelationshipEndDef endDef1 = relationshipDef.getEndDef1();
final String type1 = endDef1.getType(); final AtlasRelationshipEndDef endDef2 = relationshipDef.getEndDef2();
final AtlasRelationshipEndDef endDef2 = relationshipDef.getEndDef2(); final String type1 = endDef1.getType();
final String type2 = endDef2.getType(); final String type2 = endDef2.getType();
final String name1 = endDef1.getName(); final String name1 = endDef1.getName();
final String name2 = endDef2.getName(); final String name2 = endDef2.getName();
AtlasVertex end1TypeVertex = typeDefStore.findTypeVertexByName(type1); final AtlasVertex end1TypeVertex = typeDefStore.findTypeVertexByName(type1);
final AtlasVertex end2TypeVertex = typeDefStore.findTypeVertexByName(type2);
AtlasVertex end2TypeVertex = typeDefStore.findTypeVertexByName(type2);
if (end1TypeVertex == null) {
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND, relationshipDef.getName(), type1);
}
if (end2TypeVertex == null) {
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND, relationshipDef.getName(), type2);
}
// create an edge between the relationshipDef and each of the entityDef vertices. // create an edge between the relationshipDef and each of the entityDef vertices.
AtlasEdge edge1 = typeDefStore.getOrCreateEdge(relationshipDefVertex, end1TypeVertex, AtlasGraphUtilsV1.RELATIONSHIPTYPE_EDGE_LABEL); AtlasEdge edge1 = typeDefStore.getOrCreateEdge(relationshipDefVertex, end1TypeVertex, AtlasGraphUtilsV1.RELATIONSHIPTYPE_EDGE_LABEL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment