In TKit.DirectoryCleaner.accept() at https://github.com/openjdk/jdk/blob/8174cbd5cb797a80d48246a686897ef6fe64ed57/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java#L382 :
---
try (var pathStream = Files.walk(root, 0)) {
paths = pathStream.collect(Collectors.toList());
}
---
The intent is to get non-recursive contents of the `root` directory. However `Files.walk(root, 0)` call returns a stream that contains only the `root` itself. This is wrong as it makes the directory cleaner remove the contents of the `root` directory (intended behavior) and the `root` directory itself (NOT intended behavior).
`Files.walk(root, 0)` should be replaced with `Files.list(root)`.
The issue impacts only scenarios when jpackage tests are executed on the existing test directories and doesn't impact common scenarios of clean test runs.
---
try (var pathStream = Files.walk(root, 0)) {
paths = pathStream.collect(Collectors.toList());
}
---
The intent is to get non-recursive contents of the `root` directory. However `Files.walk(root, 0)` call returns a stream that contains only the `root` itself. This is wrong as it makes the directory cleaner remove the contents of the `root` directory (intended behavior) and the `root` directory itself (NOT intended behavior).
`Files.walk(root, 0)` should be replaced with `Files.list(root)`.
The issue impacts only scenarios when jpackage tests are executed on the existing test directories and doesn't impact common scenarios of clean test runs.
- blocks
-
JDK-8325089 jpackage utility creates an "infinite", undeleteable directory tree
- Resolved
- links to
-
Commit(master) openjdk/jdk/7133d1b9
-
Review(master) openjdk/jdk/21582