Ryan Blue created HDFS-7031: ------------------------------- Summary: 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)