@@ -360,7 +360,7 @@ public void store(History history, Repository repository)
360
360
}
361
361
} catch (IOException ex ) {
362
362
OpenGrokLogger .getLogger ().log (Level .WARNING ,
363
- "isRenamedFile() got exception" + ex );
363
+ "isRenamedFile() got exception: " + ex );
364
364
}
365
365
366
366
doFileHistory (map_entry , env , repository , null , root , false );
@@ -382,7 +382,20 @@ public void store(History history, Repository repository)
382
382
}
383
383
} catch (IOException ex ) {
384
384
OpenGrokLogger .getLogger ().log (Level .WARNING ,
385
- "isRenamedFile() got exception" + ex );
385
+ "isRenamedFile() got exception: " + ex );
386
+ }
387
+ }
388
+ // The directories for the renamed files have to be created before
389
+ // the actual files otherwise storeFile() might be racing for
390
+ // mkdirs() if there are multiple renamed files from single directory
391
+ // handled in parallel.
392
+ for (final String file : renamed_map .keySet ()) {
393
+ File cache = getCachedFile (new File (env .getSourceRootPath () + file ));
394
+ File dir = cache .getParentFile ();
395
+
396
+ if (!dir .isDirectory () && !dir .mkdirs ()) {
397
+ OpenGrokLogger .getLogger ().log (Level .WARNING ,
398
+ "Unable to create cache directory '" + dir + "'." );
386
399
}
387
400
}
388
401
final Repository repositoryF = repository ;
@@ -398,7 +411,7 @@ public void run() {
398
411
} catch (Exception ex ) {
399
412
// We want to catch any exception since we are in thread.
400
413
OpenGrokLogger .getLogger ().log (Level .WARNING ,
401
- "doFileHistory() got exception" + ex );
414
+ "doFileHistory() got exception: " + ex );
402
415
} finally {
403
416
latch .countDown ();
404
417
}
0 commit comments