[
https://issues.apache.org/jira/browse/HADOOP-9438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13648259#comment-13648259
]
Rémy SAISSY commented on HADOOP-9438:
-------------------------------------
It breaks a lot of tests.
Now you mention it, indeed the FileAlreadyExistsException is only on the
FileContext.mkdir javadoc.
The FileSystem contract and its RawLocalFileSystem implementation does not
throw such an exception.
However, the AbstractFileSystem.mkdirs method signature throws a
FileAlreadyExistsException. So maybe it should be implemented only in
FileContext.mkdir().
Does something like this would be ok in FileContext.java.mkdirs()? (and adding
exists() to the AbstractFileSystem contract).
{code}
new FSLinkResolver<Void>() {
@Override
public Void next(final AbstractFileSystem fs, final Path p)
throws IOException, UnresolvedLinkException {
if (fs.exists(p)) {
throw new FileAlreadyExistsException(p + " already exists.");
}
fs.mkdir(p, absFerms, createParent);
return null;
}
}.resolve(this, absDir);
{code}
I don't really understand what is the difference between AbstracFileSystem and
FileSystem? I didn't notice it at first but it looks like they implement almost
the same thing. Isn't it overlapping and shouldn't it be refactored?
> LocalFileContext does not throw an exception on mkdir for already existing
> directory
> ------------------------------------------------------------------------------------
>
> Key: HADOOP-9438
> URL: https://issues.apache.org/jira/browse/HADOOP-9438
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 2.0.3-alpha
> Reporter: Robert Joseph Evans
> Priority: Critical
> Attachments: HADOOP-9438.20130501.1.patch, HADOOP-9438.patch,
> HADOOP-9438.patch
>
>
> according to
> http://hadoop.apache.org/docs/current/api/org/apache/hadoop/fs/FileContext.html#mkdir%28org.apache.hadoop.fs.Path,%20org.apache.hadoop.fs.permission.FsPermission,%20boolean%29
> should throw a FileAlreadyExistsException if the directory already exists.
> I tested this and
> {code}
> FileContext lfc = FileContext.getLocalFSFileContext(new Configuration());
> Path p = new Path("/tmp/bobby.12345");
> FsPermission cachePerms = new FsPermission((short) 0755);
> lfc.mkdir(p, cachePerms, false);
> lfc.mkdir(p, cachePerms, false);
> {code}
> never throws an exception.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira