for (int i = 0; i < shards.length; i++) {
Path path = new Path(shards[i].getDirectory());
long generation = -1;
if (fs.exists(path)) {
FileSystemDirectory dir = null;
try {
dir = new FileSystemDirectory(fs, path, false, conf);
generation = LuceneUtil.getCurrentSegmentGeneration(dir);
} finally {
if (dir != null) {
dir.close();
}
}
}
if (generation != shards[i].getGeneration()) {