DirectoryStream's iterator returns parent directory if the directory is empty. For example if you pass path /my/path to get the DirectoryStream, then the iterator returns the path /my/path if /my/path is empty. DirectoryStream returns correct results if the directory is not empty.
Remote Machine
Linux homer 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
JUnit Test Snippet
The following test fails at assertFalse(iter.hasNext());. The next method also returns a Path (but that section of code is not reached in the test below).
Summary
DirectoryStream
's iterator returns parent directory if the directory is empty. For example if you pass path/my/path
to get theDirectoryStream
, then the iterator returns the path/my/path
if/my/path
is empty.DirectoryStream
returns correct results if the directory is not empty.Remote Machine
Linux homer 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
JUnit Test Snippet
The following test fails at
assertFalse(iter.hasNext());
. Thenext
method also returns aPath
(but that section of code is not reached in the test below).