[
https://issues.apache.org/jira/browse/HDFS-7031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14127315#comment-14127315
]
Arpit Agarwal commented on HDFS-7031:
-------------------------------------
Ryan is right that it mixing the default authority with a non-default scheme
looks incorrect. However path handling is fragile so unless HDFS/MapReduce is
broken I'm also inclined to leave it as it is.
> 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)