[
https://issues.apache.org/jira/browse/HADOOP-7771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13136298#comment-13136298
]
John George commented on HADOOP-7771:
-------------------------------------
{quote}
If the javadoc is true, I think should be:
{{if (!exists || !stat.isDirectory())}}
{quote}
The purpose here is to ensure that destination is a directory and not a file.
So previously when we checked for
{code}
if (!stat.isDirectory())
{code}
all we were trying to do was to ensure that the destination is a directory. The
issue is that {{stat}} could be null and so all that the check {{exist}} does
is to ensure that {{stat}} is not null before we even check if it is directory
or not! Hence, I believe the check {{if (exists && !stat.isDirectory())}} is
the right check.
{code}
// if the destination is a directory, make target a child path,
// else use the destination as-is
- if (dst.exists && dst.stat.isDirectory()) {
{code}
Here, (previously) the check for destination succeeded only if the 'dst'
already existed. With the new code, it ensures that we detect that the
destination is a directory even in cases where the destination does not exist.
The logic does not change at all. Am I missing something obvious?
Daryn,
Can you elaborate on what you mean by "The use of isDstDir appears wrong and is
duplication of most of the prior logic. "? I would definitely like to reuse the
logic if it already exists. Could you give me a cleared idea as to what you
mean?
> NPE when running hdfs dfs -copyToLocal, -get etc
> ------------------------------------------------
>
> Key: HADOOP-7771
> URL: https://issues.apache.org/jira/browse/HADOOP-7771
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.23.0, 0.24.0
> Reporter: John George
> Assignee: John George
> Priority: Blocker
> Attachments: HADOOP-7771.patch
>
>
> NPE when running hdfs dfs -copyToLocal if the destination directory does not
> exist. The behavior in branch-0.20-security is to create the directory and
> copy/get the contents from source.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira