[ 
https://issues.apache.org/jira/browse/HDFS-7031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14127255#comment-14127255
 ] 

Chris Nauroth commented on HDFS-7031:
-------------------------------------

Thanks for the additional details about your application usage, Ryan.  Another 
thing I just realized is that {{Path#makeQualified}} is annotated 
{{LimitedPrivate}} for HDFS and MapReduce only.  That implies that general 
application code should not call it, and there is no guarantee that the 
contract will remain consistent across versions.

I'm inclined to resolve this as won't fix.  Do you think that's acceptable?

> Path#makeQualified copies authority when scheme does not match
> --------------------------------------------------------------
>
>                 Key: HDFS-7031
>                 URL: https://issues.apache.org/jira/browse/HDFS-7031
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.3.0
>            Reporter: Ryan Blue
>
> I have an application that calls {{makeQualified}} that amounts to this:
> {code:java}
> new Path("file:/some/local/path").makeQualified(
>     URI.create("hdfs://nn:8020"), new Path("/"));
> {code}
> This unexpectedly produces {{file://nn:8020/some/local/path}}, using the 
> authority section from the default URI even though the path that is being 
> qualified doesn't have a scheme that matches the default URI.
> In {{Path}}, there is a check to see if the default URI should be used:
> {code:java}
>     if (scheme != null &&
>         (authority != null || defaultUri.getAuthority() == null))
>       return path;
> {code}
> I think this should be:
> {code:java}
>     // if the scheme matches and there is no authority, use the default
>     if (scheme != null && scheme.equals(defaultUri.getScheme()) &&
>         (authority != null || defaultUri.getAuthority() == null))
>       return path;
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to