Merge branch 'stable-3.3' into master

* stable-3.3:
  Don't output directories during task walk.

Change-Id: I022563e4fc002921524a31bdca7793e45c9bbe59
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 c67bb49..5b993dd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -73,9 +73,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();
     }
@@ -169,15 +167,15 @@
   }
 
   private Stream<ReplicateRefUpdate> streamRecursive(Path dir) {
-    return walk(dir)
+    return walkNonDirs(dir)
         .map(path -> ReplicateRefUpdate.createOptionally(path, gson))
         .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) {