8042816: (fs) Path.register doesn't throw IllegalArgumentException if multiple OVERFLOW events are specified, part 2
Reviewed-by: chegar
This commit is contained in:
parent
599fcee2f2
commit
3162db1047
@ -74,8 +74,6 @@ class PollingWatchService
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// check events - CCE will be thrown if there are invalid elements
|
// check events - CCE will be thrown if there are invalid elements
|
||||||
if (events.length == 0)
|
|
||||||
throw new IllegalArgumentException("No events to register");
|
|
||||||
final Set<WatchEvent.Kind<?>> eventSet =
|
final Set<WatchEvent.Kind<?>> eventSet =
|
||||||
new HashSet<WatchEvent.Kind<?>>(events.length);
|
new HashSet<WatchEvent.Kind<?>>(events.length);
|
||||||
for (WatchEvent.Kind<?> event: events) {
|
for (WatchEvent.Kind<?> event: events) {
|
||||||
@ -90,8 +88,6 @@ class PollingWatchService
|
|||||||
|
|
||||||
// OVERFLOW is ignored
|
// OVERFLOW is ignored
|
||||||
if (event == StandardWatchEventKinds.OVERFLOW) {
|
if (event == StandardWatchEventKinds.OVERFLOW) {
|
||||||
if (events.length == 1)
|
|
||||||
throw new IllegalArgumentException("No events to register");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +96,8 @@ class PollingWatchService
|
|||||||
throw new NullPointerException("An element in event set is 'null'");
|
throw new NullPointerException("An element in event set is 'null'");
|
||||||
throw new UnsupportedOperationException(event.name());
|
throw new UnsupportedOperationException(event.name());
|
||||||
}
|
}
|
||||||
|
if (eventSet.isEmpty())
|
||||||
|
throw new IllegalArgumentException("No events to register");
|
||||||
|
|
||||||
// A modifier may be used to specify the sensitivity level
|
// A modifier may be used to specify the sensitivity level
|
||||||
SensitivityWatchEventModifier sensivity = SensitivityWatchEventModifier.MEDIUM;
|
SensitivityWatchEventModifier sensivity = SensitivityWatchEventModifier.MEDIUM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user