diff options
Diffstat (limited to 'openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java')
-rw-r--r-- | openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java index 57486b81e3..cebff91160 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java @@ -24,19 +24,21 @@ public class ImportCommand { if (zippedFile == null){ logger.error("Import must have a valid file as an input."); } - zippedFile = zippedFile.replaceAll("\\r", ""); - if(filterItem != null) { - filterItem = filterItem.replaceAll("\\r", ""); + if (zippedFile != null) { + zippedFile = zippedFile.replaceAll("\\r", ""); + if (filterItem != null) { + filterItem = filterItem.replaceAll("\\r", ""); + } + Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY); + ExportDataCommand.initDir(rootDir); + ZipUtils.unzip(Paths.get(zippedFile), rootDir); + TreeWalker.walkFiles(context, rootDir, filterItem); + FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end. } - Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY); - ExportDataCommand.initDir(rootDir); - ZipUtils.unzip(Paths.get(zippedFile), rootDir); - TreeWalker.walkFiles(context, rootDir, filterItem); - FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end. + } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } |