diff options
author | tomlu <tomlu@google.com> | 2018-01-09 13:46:29 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-09 13:50:14 -0800 |
commit | 7f17d08d5be04d1fc393958c9895747c9dc88b30 (patch) | |
tree | 2de1b6538ea5c6d6a0e014fdff2a07d94623ad2d /src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java | |
parent | 457a226f69ab56109fd5ec9163ac57181d715bda (diff) |
Automated rollback of commit cb7689404ef9a69488d64bfc2e0bfb9326e664d6.
*** Reason for rollback ***
Rolling forward after the underlying issue has been fixed.
*** Original change description ***
Automated rollback of commit 6a54339bb943702bd7dffc43f85267dac98dc355.
*** Reason for rollback ***
b/71442447
*** Original change description ***
Call through to Path#createDirectoryAndParents from FileUtils.
This CL removes a method that due to its implementation causes threading difficulties for Path#createDirectory.
The tests for the method are brought across to FileSystemTests since the methods are now implemented natively by the FileSystem classes. The tests were also cleaned up.
The test revealed an edge c...
***
PiperOrigin-RevId: 181367850
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java index 4477275f1f..0dac1c4725 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java @@ -261,7 +261,15 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat { @Override public void createDirectoryAndParents(Path path) throws IOException { java.nio.file.Path nioPath = getNioPath(path); - Files.createDirectories(nioPath); + try { + Files.createDirectories(nioPath); + } catch (java.nio.file.FileAlreadyExistsException e) { + // Files.createDirectories will handle this case normally, but if the existing + // file is a symlink to a directory then it still throws. Swallow this. + if (!path.isDirectory()) { + throw e; + } + } } private boolean linkExists(File file) { |