diff --git a/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java b/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java index 4535b8606..b6b735e59 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java +++ b/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java @@ -352,7 +352,7 @@ private void copyRecursive(Path source, Path target, FileCopyMode mode) throws I Iterator iterator = childStream.iterator(); while (iterator.hasNext()) { Path child = iterator.next(); - copyRecursive(child, target.resolve(child.getFileName()), mode); + copyRecursive(child, target.resolve(child.getFileName().toString()), mode); } } } else if (Files.exists(source)) { @@ -622,16 +622,13 @@ public void extractZip(Path file, Path targetDir) { //FileInputStream fis = new FileInputStream(file.toFile()); ZipInputStream zis = new ZipInputStream(fis); IdeProgressBar pb = getProgressbarForUnpacking(getFileSize(file)) ) { for (Path root : fs.getRootDirectories()) { - Path filename = root.getFileName(); - if (filename == null) { - Iterator iterator = Files.list(root).iterator(); + try (Stream list = Files.list(root)) { + Iterator iterator = list.iterator(); while (iterator.hasNext()) { Path child = iterator.next(); String fileName = child.getFileName().toString(); copy(child, targetDir.resolve(fileName), FileCopyMode.COPY_TREE_CONTENT); } - } else { - copy(root, targetDir.resolve(filename), FileCopyMode.COPY_TREE_CONTENT); } } } catch (IOException e) {