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/016eaffa
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/016eaffa
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/016eaffa

Branch: refs/heads/master
Commit: 016eaffae5518b86bba7bfdda4fc720749362a93
Parents: 8a26c79
Author: Ashutosh Mestry <ames...@hortonworks.com>
Authored: Thu Oct 4 14:38:21 2018 -0700
Committer: Ashutosh Mestry <ames...@hortonworks.com>
Committed: Thu Oct 11 17:21:29 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/016eaffa/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/016eaffa/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; }

Reply via email to