TP-62631 | Null pointer exception handling
This commit is contained in:
@@ -50,18 +50,27 @@ public class FileZipper {
|
||||
ZipOutputStream zos = new ZipOutputStream(fos);
|
||||
zos.setLevel(Deflater.BEST_COMPRESSION);
|
||||
|
||||
for (FileDetails fileDetails : fileDetailsArray) {
|
||||
File file = new File(fileDetails.getPath());
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
zos.putNextEntry(new ZipEntry(fileDetails.getName()));
|
||||
if(fileDetailsArray != null) {
|
||||
for (FileDetails fileDetails : fileDetailsArray) {
|
||||
if(fileDetails != null) {
|
||||
String filePath = fileDetails.getPath();
|
||||
String fileName = fileDetails.getName();
|
||||
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
if(filePath != null && fileName != null) {
|
||||
File file = new File(filePath);
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
zos.putNextEntry(new ZipEntry(fileName));
|
||||
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
zos.closeEntry();
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zos.closeEntry();
|
||||
fis.close();
|
||||
}
|
||||
|
||||
zos.close();
|
||||
|
||||
Reference in New Issue
Block a user