[
https://issues.apache.org/jira/browse/HADOOP-11618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14347327#comment-14347327
]
Brahma Reddy Battula commented on HADOOP-11618:
-----------------------------------------------
Thanks a lot for review..
{quote}
In both cases, we are going to assert that ftpFs.getUri() results in
ftp://dummy-host:21
{quote}
will not return default port where URI having port..whenever port=-1(not
configured)then only default port will be return..Please check following code
for same..
{code}
private URI getUri(URI uri, String supportedScheme,
boolean authorityNeeded, int defaultPort) throws URISyntaxException {
checkScheme(uri, supportedScheme);
// A file system implementation that requires authority must always
// specify default port
if (defaultPort < 0 && authorityNeeded) {
throw new HadoopIllegalArgumentException(
"FileSystem implementation error - default port " + defaultPort
+ " is not valid");
}
String authority = uri.getAuthority();
if (authority == null) {
if (authorityNeeded) {
throw new HadoopIllegalArgumentException("Uri without authority: " +
uri);
} else {
return new URI(supportedScheme + ":///");
}
}
// authority is non null - AuthorityNeeded may be true or false.
int port = uri.getPort();
port = (port == -1 ? defaultPort : port);
if (port == -1) { // no port supplied and default port is not specified
return new URI(supportedScheme, authority, "/", null);
}
return new URI(supportedScheme + "://" + uri.getHost() + ":" + port);
}
{code}
and 001 patch also will call this method only...Anyway I updated patch,,kindly
review the same..
> DelegateToFileSystem always uses default FS's default port
> -----------------------------------------------------------
>
> Key: HADOOP-11618
> URL: https://issues.apache.org/jira/browse/HADOOP-11618
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Affects Versions: 2.6.0
> Reporter: Gera Shegalov
> Assignee: Brahma Reddy Battula
> Attachments: HADOOP-11618-001.patch, HADOOP-11618-002.patch,
> HADOOP-11618.patch
>
>
> DelegateToFileSystem constructor has the following code:
> {code}
> super(theUri, supportedScheme, authorityRequired,
> FileSystem.getDefaultUri(conf).getPort());
> {code}
> The default port should be taken from theFsImpl instead.
> {code}
> super(theUri, supportedScheme, authorityRequired,
> theFsImpl.getDefaultPort());
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)