Don't output directories during task walk.

Outputting directories leads to extra exceptions when trying to read
tasks, prevent outputting them in the first place.  Not only will this
prevent bogus log warnings, it should be faster since there is now less
work to do. Remove the unreliable warning filter during task
deserialization since it should no longer be needed in the normal path
now.

Change-Id: I6fa2bdc27ce37333299f7ce475bb77d5c1de1d0b
Bug: Issue 13480
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
index fe5e7cb..39ee4f4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -71,9 +71,7 @@
       } catch (NoSuchFileException e) {
         logger.atFine().log("File %s not found while reading task", file);
       } catch (IOException e) {
-        if (!e.getMessage().contains("not a regular file")) {
-          logger.atSevere().withCause(e).log("Error while reading task %s", file);
-        }
+        logger.atSevere().withCause(e).log("Error while reading task %s", file);
       }
       return Optional.empty();
     }
@@ -166,15 +164,15 @@
   }
 
   private Stream<ReplicateRefUpdate> streamRecursive(Path dir) {
-    return walk(dir)
+    return walkNonDirs(dir)
         .map(path -> ReplicateRefUpdate.createOptionally(path))
         .filter(Optional::isPresent)
         .map(Optional::get);
   }
 
-  private static Stream<Path> walk(Path path) {
+  private static Stream<Path> walkNonDirs(Path path) {
     try {
-      return Stream.concat(Stream.of(path), Files.list(path).flatMap(sub -> walk(sub)));
+      return Files.list(path).flatMap(sub -> walkNonDirs(sub));
     } catch (NotDirectoryException e) {
       return Stream.of(path);
     } catch (Exception e) {