zip4j icon indicating copy to clipboard operation
zip4j copied to clipboard

java.io.IOException: Invalid file path

Open IvoDrag opened this issue 3 years ago • 0 comments
trafficstars

I have a program which extracts zip files, it works fine with almost all zips but with one zip everytime I get a java.io.IOException: Invalid file path. I don't know why because the path exists and the file is writeable for java. Also the zip file isn't corrupt. Could the problem come because there are many files in the zip?

Thanks and regards

    public static void extractZipsInWorkFolder(File extractedFiles, File testFolder) throws IOException {
        File[] fileListing = extractedFiles.listFiles();
        if (fileListing != null) {
            for (File file : fileListing) {
                if (file.isDirectory()) {
                    extractZipsInWorkFolder(file, testFolder);
                } else if (FilenameUtils.getExtension(String.valueOf(file)).equals("zip")) {
                    System.out.println("Extracting this zip: " + file);
                    ZipFile zipFile = new ZipFile(file);
                    System.out.println("Extracting to: " + testFolder);
                    zipFile.extractAll(String.valueOf(testFolder));
//                    file.delete();
                }
            }
        } else {
            throw new NullPointerException("ExtractZipsInWorkFolder Directory is null");
        }
    }

IvoDrag avatar Aug 17 '22 11:08 IvoDrag