Hello, This topic should be discussed on the nio-dev mailing list so I am re-directing the thread there. Please omit core-libs-dev from any replies, thanks.
On Dec 4, 2016, at 12:50 PM, Alan Snyder <fishgar...@cbfiddle.com> wrote: > I notice that PollingWatchService never checks the file key when it reads a > directory to see if it is reading from the same directory that it started > with. To clarify, do you intend that this check should be prior to the creation of the DirectoryStream at [1]? > I suspect that creates a potential for incorrect behavior if the directory > tree is rearranged (between polls) so that the original path accesses a > different directory. > > Specifically, if the original directory remains available via some other > path, then someone watching on that path or trying to register using that > path will be using a watch service that is reading the wrong directory. This does seem like a potential problem. Thanks, Brian [1] http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/3f4dab6bb48e/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java#l345