ATLAS-2897: Better handling of empty zip files.
Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/e9e012a8 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/e9e012a8 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/e9e012a8 Branch: refs/heads/branch-1.0 Commit: e9e012a81063884ebd5754dac4b89f9c41d4eb53 Parents: 7f170c8 Author: Ashutosh Mestry <[email protected]> Authored: Thu Oct 4 14:38:21 2018 -0700 Committer: Ashutosh Mestry <[email protected]> Committed: Thu Nov 1 15:42:57 2018 -0700 ---------------------------------------------------------------------- .../atlas/repository/impexp/AtlasServerService.java | 1 - .../org/apache/atlas/repository/impexp/ZipSource.java | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/e9e012a8/repository/src/main/java/org/apache/atlas/repository/impexp/AtlasServerService.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/AtlasServerService.java b/repository/src/main/java/org/apache/atlas/repository/impexp/AtlasServerService.java index a3489a8..13a8cd9 100644 --- a/repository/src/main/java/org/apache/atlas/repository/impexp/AtlasServerService.java +++ b/repository/src/main/java/org/apache/atlas/repository/impexp/AtlasServerService.java @@ -65,7 +65,6 @@ public class AtlasServerService { try { return dataAccess.load(server); } catch (AtlasBaseException e) { - LOG.error("dataAccess", e); throw e; } } http://git-wip-us.apache.org/repos/asf/atlas/blob/e9e012a8/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java index be8c168..bf23f81 100644 --- a/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java +++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java @@ -72,10 +72,14 @@ public class ZipSource implements EntityImportStream { } private boolean isZipFileEmpty() { - return MapUtils.isEmpty(guidEntityJsonMap) || - (guidEntityJsonMap.containsKey(ZipExportFileNames.ATLAS_EXPORT_ORDER_NAME.toString()) && - (guidEntityJsonMap.get(ZipExportFileNames.ATLAS_EXPORT_ORDER_NAME.toString()) == null) - ); + if (MapUtils.isEmpty(guidEntityJsonMap)) { + return true; + } + + String key = ZipExportFileNames.ATLAS_EXPORT_ORDER_NAME.toString(); + return (guidEntityJsonMap.containsKey(key) && + StringUtils.isNotEmpty(guidEntityJsonMap.get(key)) && + guidEntityJsonMap.get(key).equals("[]")); } public ImportTransforms getImportTransform() { return this.importTransform; }
