Tentatively ignore temp files used for "safe writes" while watching files

Some IDEs (e.g. IDEA with "safe writes" turned on) will write to a
temporary file before moving to replace the actual file; this caused the
ResourceAccumulator to see an ENTRY_CREATE event but the file is deleted
before it could be looked at, and a NoSuchFileException is thrown as a
consequence.

Bug: #9310
Bug-Link: https://github.com/gwtproject/gwt/issues/9310
Change-Id: I3567bcc3ef899cd807f2ee580069992cc87a814b
diff --git a/dev/core/src/com/google/gwt/dev/resource/impl/ResourceAccumulator.java b/dev/core/src/com/google/gwt/dev/resource/impl/ResourceAccumulator.java
index 45709b2..e10c1f2 100644
--- a/dev/core/src/com/google/gwt/dev/resource/impl/ResourceAccumulator.java
+++ b/dev/core/src/com/google/gwt/dev/resource/impl/ResourceAccumulator.java
@@ -22,11 +22,13 @@
 import com.google.gwt.thirdparty.guava.common.collect.Multimap;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.ref.WeakReference;
 import java.nio.file.DirectoryStream;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
 import java.nio.file.WatchEvent;
 import java.nio.file.WatchKey;
@@ -135,14 +137,18 @@
   }
 
   private void onNewPath(Path path) throws IOException {
-    if (Files.isHidden(path)) {
-      return;
-    }
+    try {
+      if (Files.isHidden(path)) {
+        return;
+      }
 
-    if (Files.isRegularFile(path)) {
-      onNewFile(path);
-    } else {
-      onNewDirectory(path);
+      if (Files.isRegularFile(path)) {
+        onNewFile(path);
+      } else {
+        onNewDirectory(path);
+      }
+    } catch (NoSuchFileException | FileNotFoundException e) {
+      // ignore: might happen, e.g., for temporary files used for "safe writes" by IDEs/editors
     }
   }