Program: 171023
Project: 171023
Buggy source:
private void processParentCategory(AtlasGlossaryCategory newObj,AtlasGlossaryCategory existing,RelationshipOperation op) throws AtlasBaseException {
  AtlasRelatedCategoryHeader newParent=newObj.getParentCategory();
  AtlasRelatedCategoryHeader existingParent=existing.getParentCategory();
switch (op) {
case CREATE:
    if (Objects.nonNull(newParent)) {
      if (DEBUG_ENABLED) {
        LOG.debug("String_Node_Str",existing.getGuid(),newParent.getDisplayText());
      }
      createRelationship(defineCategoryHierarchyLink(newParent,existing.getGuid()));
    }
  break;
case UPDATE:
if (Objects.equals(newParent,existingParent)) {
  if (DEBUG_ENABLED) {
    LOG.debug("String_Node_Str");
  }
  break;
}
if (Objects.isNull(existingParent)) {
if (DEBUG_ENABLED) {
  LOG.debug("String_Node_Str",existing.getGuid(),newParent.getDisplayText());
}
createRelationship(defineCategoryHierarchyLink(newParent,existing.getGuid()));
}
 else if (Objects.isNull(newParent)) {
if (DEBUG_ENABLED) {
  LOG.debug("String_Node_Str",existing.getGuid(),existingParent.getDisplayText());
}
relationshipStore.deleteById(existingParent.getRelationGuid());
}
 else {
if (DEBUG_ENABLED) {
  LOG.debug("String_Node_Str",existing.getGuid(),existingParent.getDisplayText(),newParent.getDisplayText());
}
AtlasRelationship parentRelationship=relationshipStore.getById(existingParent.getRelationGuid());
if (existingParent.getCategoryGuid().equals(newParent.getCategoryGuid())) {
  updateRelationshipAttributes(parentRelationship,newParent);
  relationshipStore.update(parentRelationship);
}
 else {
  relationshipStore.deleteById(parentRelationship.getGuid());
  createRelationship(defineCategoryHierarchyLink(newParent,existing.getGuid()));
}
}
break;
case DELETE:
if (Objects.nonNull(existingParent)) {
if (DEBUG_ENABLED) {
LOG.debug("String_Node_Str",existing.getGuid(),existingParent.getDisplayText());
}
relationshipStore.deleteById(existingParent.getRelationGuid());
}
break;
}
}

Fixed version (ground truth):
private void processParentCategory(AtlasGlossaryCategory updatedCategory,AtlasGlossaryCategory existing,RelationshipOperation op) throws AtlasBaseException {
  AtlasRelatedCategoryHeader newParent=updatedCategory.getParentCategory();
  AtlasRelatedCategoryHeader existingParent=existing.getParentCategory();
switch (op) {
case CREATE:
    if (Objects.nonNull(newParent)) {
      if (DEBUG_ENABLED) {
        LOG.debug("String_Node_Str",existing.getGuid(),newParent.getDisplayText());
      }
      createRelationship(defineCategoryHierarchyLink(newParent,existing.getGuid()));
    }
  break;
case UPDATE:
if (Objects.equals(newParent,existingParent)) {
  if (DEBUG_ENABLED) {
    LOG.debug("String_Node_Str");
  }
  break;
}
if (Objects.isNull(existingParent)) {
if (DEBUG_ENABLED) {
  LOG.debug("String_Node_Str",existing.getGuid(),newParent.getDisplayText());
}
createRelationship(defineCategoryHierarchyLink(newParent,existing.getGuid()));
}
 else if (Objects.isNull(newParent)) {
if (DEBUG_ENABLED) {
  LOG.debug("String_Node_Str",existing.getGuid(),existingParent.getDisplayText());
}
relationshipStore.deleteById(existingParent.getRelationGuid());
}
 else {
if (DEBUG_ENABLED) {
  LOG.debug("String_Node_Str",existing.getGuid(),existingParent.getDisplayText(),newParent.getDisplayText());
}
AtlasRelationship parentRelationship=relationshipStore.getById(existingParent.getRelationGuid());
if (existingParent.getCategoryGuid().equals(newParent.getCategoryGuid())) {
  updateRelationshipAttributes(parentRelationship,newParent);
  relationshipStore.update(parentRelationship);
}
 else {
  relationshipStore.deleteById(parentRelationship.getGuid());
  createRelationship(defineCategoryHierarchyLink(newParent,existing.getGuid()));
}
}
break;
case DELETE:
if (Objects.nonNull(existingParent)) {
if (DEBUG_ENABLED) {
LOG.debug("String_Node_Str",existing.getGuid(),existingParent.getDisplayText());
}
relationshipStore.deleteById(existingParent.getRelationGuid());
}
break;
}
}