Author: nscavell
Date: 2011-09-07 12:35:33 -0400 (Wed, 07 Sep 2011)
New Revision: 7331
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
Log:
GTNPORTAL-2084: Allow for emtpy zip file for import.
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-09-07
13:54:58 UTC (rev 7330)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java 2011-09-07
16:35:33 UTC (rev 7331)
@@ -107,6 +107,7 @@
Map<SiteKey, MopImport> importMap = new HashMap<SiteKey, MopImport>();
final NonCloseableZipInputStream zis = new
NonCloseableZipInputStream(inputStream);
ZipEntry entry;
+ boolean empty = false;
try
{
log.info("Preparing data for import.");
@@ -114,6 +115,9 @@
{
// Skip directories
if (entry.isDirectory()) continue;
+ // Skip empty entries (this allows empty zip files to not cause exceptions).
+ empty = entry.getName().equals("");
+ if (empty) continue;
// Parse zip entry
String[] parts = parseEntry(entry);
@@ -186,6 +190,12 @@
}
}
+ if (empty)
+ {
+ log.info("Nothing to import, zip file empty.");
+ return;
+ }
+
// Perform import
Map<SiteKey, MopImport> importsRan = new HashMap<SiteKey,
MopImport>();
try
Show replies by date