FULL PRODUCT VERSION :
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The WatchDir.java example from https://docs.oracle.com/javase/tutorial/essential/io/notification.html demonstrates the WatchService functionality and is expected to produce events for created, modified and removed files in a folder tree.
However, when a new sub-folder with some files appears (e.g. is copied from somewhere) in the tree only an event for the sub-folder is fired and there are no events for the files contained in this folder. This way a client of the WatchService will never be informed about the existence of these new files. This seems to be in conflict with the promised behavior: "The java.nio.file package provides a file change notification API, called the Watch Service API. This API enables you to register a directory (or directories) with the watch service. When registering, you tell the service which types of events you are interested in: file creation, file deletion, or file modification."
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Run the example WatchDir.java with the -r option and some folder to watch (e.g. "rootWatchFolder")
- Create somewhere outside of this folder a new folder (e.g. "test") with e.g. 2 text files
- Copy the "test" folder into the "rootWatchFolder"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
- A created event for the "test" folder
- One created event for every text file in the folder "test"
ACTUAL -
- There are no events for the new files appeared together with the "test" folder, there is only an event for the folder itself.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error messages
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
https://docs.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Not found yet
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The WatchDir.java example from https://docs.oracle.com/javase/tutorial/essential/io/notification.html demonstrates the WatchService functionality and is expected to produce events for created, modified and removed files in a folder tree.
However, when a new sub-folder with some files appears (e.g. is copied from somewhere) in the tree only an event for the sub-folder is fired and there are no events for the files contained in this folder. This way a client of the WatchService will never be informed about the existence of these new files. This seems to be in conflict with the promised behavior: "The java.nio.file package provides a file change notification API, called the Watch Service API. This API enables you to register a directory (or directories) with the watch service. When registering, you tell the service which types of events you are interested in: file creation, file deletion, or file modification."
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Run the example WatchDir.java with the -r option and some folder to watch (e.g. "rootWatchFolder")
- Create somewhere outside of this folder a new folder (e.g. "test") with e.g. 2 text files
- Copy the "test" folder into the "rootWatchFolder"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
- A created event for the "test" folder
- One created event for every text file in the folder "test"
ACTUAL -
- There are no events for the new files appeared together with the "test" folder, there is only an event for the folder itself.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error messages
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
https://docs.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Not found yet