Skip to content

Commit 2134a6e

Browse files
Vladimir Kotalahornace
Vladimir Kotal
authored andcommitted
avoid warning in case of mkdirs() races
1 parent 10ba05b commit 2134a6e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/FileHistoryCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ public void store(History history, Repository repository, String tillRevision) t
460460
history.strip();
461461

462462
File histDataDir = new File(getRepositoryHistDataDirname(repository));
463-
if (!histDataDir.isDirectory() && !histDataDir.mkdirs()) {
463+
// Check the directory again in case of races (might happen in the presence of sub-repositories).
464+
if (!histDataDir.isDirectory() && !histDataDir.mkdirs() && !histDataDir.isDirectory()) {
464465
LOGGER.log(Level.WARNING, "cannot create history cache directory for ''{0}''", histDataDir);
465466
}
466467

0 commit comments

Comments
 (0)