|
@@ -433,8 +433,8 @@ public class FileManager {
|
|
|
if ( !isFolderExists(folderToCompress)) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (isFolderExists( tempZipFilePath )) {
|
|
|
- return false;
|
|
|
+ if ( isFolderExists( tempZipFilePath )) {
|
|
|
+ deleteFolder(tempZipFilePath);
|
|
|
}
|
|
|
FileOutputStream fileOutputStream = null;
|
|
|
ZipOutputStream zipOutputStream = null;
|
|
@@ -458,6 +458,8 @@ public class FileManager {
|
|
|
}
|
|
|
|
|
|
private void compressFolder(String sourceFolder, ZipOutputStream zipOutputStream) {
|
|
|
+ System.out.println( "sourceFolder" );
|
|
|
+ System.out.println( sourceFolder );
|
|
|
File folder = new File(sourceFolder);
|
|
|
File[] files = folder.listFiles();
|
|
|
if (files != null) {
|
|
@@ -465,13 +467,15 @@ public class FileManager {
|
|
|
if (file.isDirectory()) {
|
|
|
compressFolder( sourceFolder + separator + file.getName(), zipOutputStream);
|
|
|
} else {
|
|
|
- addToZipFile(file.getName(), sourceFolder + File.separator + file.getName(), zipOutputStream);
|
|
|
+ addToZipFile(file.getName(), sourceFolder + separator + file.getName(), zipOutputStream);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void addToZipFile(String fileName, String fileAbsolutePath, ZipOutputStream zipOutputStream) {
|
|
|
+ System.out.println( "fileAbsolutePath" );
|
|
|
+ System.out.println( fileAbsolutePath );
|
|
|
FileInputStream fileInputStream = null;
|
|
|
ZipEntry entry = new ZipEntry(fileName);
|
|
|
try {
|
|
@@ -484,9 +488,6 @@ public class FileManager {
|
|
|
}
|
|
|
} catch (Exception ignored) {}finally {
|
|
|
try {
|
|
|
- if ( Objects.nonNull(zipOutputStream )) {
|
|
|
- zipOutputStream.closeEntry();
|
|
|
- }
|
|
|
if ( Objects.nonNull(fileInputStream)) {
|
|
|
fileInputStream.close();
|
|
|
}
|