LocalDiskRepositoryManager: Handle failure to visit file/path

If Files.walkFileTree fails due to a directory or file in the git root
being inaccessible, it throws an exception and subsequent directories
are not processed.

Override the visitFileFailed method on the visitor. Log the error and
continue.

Bug: Issue 5698
Change-Id: I7f4d76b30f3f8907128dacf357b70eea47fb0962
This commit is contained in:
David Pursehouse
2017-03-04 11:11:58 +09:00
parent 9a87426dd8
commit 9eb3b2fd86

View File

@@ -405,6 +405,12 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager,
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException e) {
log.warn(e.getMessage());
return FileVisitResult.CONTINUE;
}
private boolean isRepo(Path p) {
String name = p.getFileName().toString();
return !name.equals(Constants.DOT_GIT)