in src/main/java/com/googlesource/gerrit/plugins/javamelody/GerritMonitoringFilter.java [163:185]
private String getStorageDir() {
// default to old path for javamelody storage-directory if it exists
final Path tmp = Paths.get(System.getProperty("java.io.tmpdir")).resolve(JAVAMELODY_PREFIX);
if (Files.isDirectory(tmp)) {
log.atWarning().log(
"Javamelody data exists in 'tmp' [%s]. Configuration (if any) will be ignored.", tmp);
return tmp.toString();
}
// plugin config has the highest priority
Path storageDir =
Optional.ofNullable(cfg.getString(STORAGE_DIR)).map(Paths::get).orElse(defaultDataDir);
if (!Files.isDirectory(storageDir)) {
try {
Files.createDirectories(storageDir);
} catch (IOException e) {
log.atSevere().withCause(e).log(
"Creation of javamelody data dir [%s] failed.", storageDir);
throw new RuntimeException(e);
}
}
return storageDir.toString();
}