This is an automated email from the ASF dual-hosted git repository. nixon pushed a commit to branch branch-0.8 in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-0.8 by this push: new 3291213 ATLAS-3050: OGM DataAccess error handling. 3291213 is described below commit 32912137637cd00018c4c9c6dd9dc9feb26665c2 Author: Ashutosh Mestry <ames...@hortonworks.com> AuthorDate: Fri Feb 15 10:04:16 2019 -0800 ATLAS-3050: OGM DataAccess error handling. Signed-off-by: nixonrodrigues <ni...@apache.org> --- .../java/org/apache/atlas/repository/ogm/DataAccess.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/ogm/DataAccess.java b/repository/src/main/java/org/apache/atlas/repository/ogm/DataAccess.java index 63b345e..dcf002b 100644 --- a/repository/src/main/java/org/apache/atlas/repository/ogm/DataAccess.java +++ b/repository/src/main/java/org/apache/atlas/repository/ogm/DataAccess.java @@ -50,9 +50,9 @@ public class DataAccess { DataTransferObject<T> dto = (DataTransferObject<T>)dtoRegistry.get(obj.getClass()); AtlasEntityWithExtInfo entityWithExtInfo = dto.toEntityWithExtInfo(obj); - EntityMutationResponse entityMutationResponse = entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), false); - - if (hasError(entityMutationResponse)) { + try { + entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), false); + } catch (AtlasBaseException e) { throw new AtlasBaseException(AtlasErrorCode.DATA_ACCESS_SAVE_FAILED, obj.toString()); } } @@ -98,12 +98,4 @@ public class DataAccess { deleteUsingGuid(object.getGuid()); } } - - private boolean hasError(EntityMutationResponse er) { - return (er == null || - !((er.getCreatedEntities() != null && er.getCreatedEntities().size() > 0) - || (er.getUpdatedEntities() != null && er.getUpdatedEntities().size() > 0) - ) - ); - } }