Skip to content

Commit

Permalink
fix: add NPE check in soft del handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed Feb 13, 2024
1 parent 139f383 commit 92b0356
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.atlas.repository.store.graph.v1;

import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.RequestContext;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.instance.AtlasEntity.Status;
Expand Down Expand Up @@ -96,9 +97,13 @@ protected void deleteEdge(AtlasEdge edge, boolean force) throws AtlasBaseExcepti
}
if (isRelationshipEdge)
AtlasRelationshipStoreV2.recordRelationshipMutation(AtlasRelationshipStoreV2.RelationshipMutation.RELATIONSHIP_SOFT_DELETE, edge, entityRetriever);
} catch (NullPointerException npe) {
LOG.error("Error while deleting edge {}", GraphHelper.string(edge), npe);
throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_SERVER_ERROR, npe);
} catch (Exception e) {
LOG.error("Error while deleting edge {}", GraphHelper.string(edge), e);
throw e;
throw new AtlasBaseException(e);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1044,11 +1044,6 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex,
}
}
}
catch (NullPointerException npe) {
String id = entityVertex.getIdForDisplay()==null ? "null" :entityVertex.getIdForDisplay();
LOG.error("mapVertexToAtlasEntityHeader: failed for entityVertex with id {}", id, npe);
throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_SERVER_ERROR, npe, "mapVertexToAtlasEntityHeader: failed for entityVertex with id " + id);
}
finally {
RequestContext.get().endMetricRecord(metricRecorder);
}
Expand Down

0 comments on commit 92b0356

Please sign in to comment.