summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
0da8a10)
This should at least provide better diagnostics in case of unexpected
failure.
refs #7600
Change-Id: Ib5fb10798257cd35d3d8c3c533574b17a62e715b
import java.io.File;
import java.io.IOException;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
}
private static void createDirectory(File path) throws IOException {
}
private static void createDirectory(File path) throws IOException {
- if (path.exists() && !path.isDirectory())
- throw new IOException("Could not create index directory " + path + ", a file by that name already exists");
- path.mkdirs();
- if (!path.exists())
- throw new IOException("Could not create index directory " + path + " for an unknown reason");
- if (!path.isDirectory())
+ Path p = path.toPath();
+ if (Files.exists(p) && !Files.isDirectory(p))
throw new IOException("Could not create index directory " + path + ", a file by that name already exists");
throw new IOException("Could not create index directory " + path + ", a file by that name already exists");
+ Files.createDirectories(p);