Correctly detect symlinked log directory on startup

On startup the FileUtil.mkdirsOrDie() method uses the
Files.createDirectories() method to detect if the
'$site_path/logs' directory exists and create it if not. This method
fails if the '$site_path/logs' is a symlink to another directory and
prevents the server from starting. Add a call to Files.isDirectory()
first to correctly detect this scenario and allow the server to start.

Bug: Issue 3733
Change-Id: I0f7e2c94086641178c1772a404baa87f3bd7deb2
This commit is contained in:
Mark Elkins
2016-01-05 11:03:51 -05:00
parent 986fa3ba08
commit ccb946c97a

View File

@@ -88,7 +88,9 @@ public class FileUtil {
public static Path mkdirsOrDie(Path p, String errMsg) {
try {
Files.createDirectories(p);
if (!Files.isDirectory(p)) {
Files.createDirectories(p);
}
return p;
} catch (IOException e) {
throw new Die(errMsg + ": " + p, e);