Skip to content

Commit

Permalink
HDDS-1938. Change omPort parameter type from String to int in BasicOz…
Browse files Browse the repository at this point in the history
…oneFileSystem#createAdapter (#1305)
  • Loading branch information
smengcl authored and bharatviswa504 committed Aug 18, 2019
1 parent e618256 commit 3bba808
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void initialize(URI name, Configuration conf) throws IOException {
String remaining = matcher.groupCount() == 3 ? matcher.group(3) : null;

String omHost = null;
String omPort = String.valueOf(-1);
int omPort = -1;
if (!isEmpty(remaining)) {
String[] parts = remaining.split(":");
// Array length should be either 1(host) or 2(host:port)
Expand All @@ -122,13 +122,14 @@ public void initialize(URI name, Configuration conf) throws IOException {
}
omHost = parts[0];
if (parts.length == 2) {
omPort = parts[1];
try {
omPort = Integer.parseInt(parts[1]);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(URI_EXCEPTION_TEXT);
}
} else {
// If port number is not specified, read it from config
omPort = String.valueOf(OmUtils.getOmRpcPort(conf));
}
if (!isNumber(omPort)) {
throw new IllegalArgumentException(URI_EXCEPTION_TEXT);
omPort = OmUtils.getOmRpcPort(conf);
}
}

Expand Down Expand Up @@ -170,7 +171,7 @@ public void initialize(URI name, Configuration conf) throws IOException {

protected OzoneClientAdapter createAdapter(Configuration conf,
String bucketStr,
String volumeStr, String omHost, String omPort,
String volumeStr, String omHost, int omPort,
boolean isolatedClassloader) throws IOException {

if (isolatedClassloader) {
Expand All @@ -180,8 +181,7 @@ protected OzoneClientAdapter createAdapter(Configuration conf,

} else {

return new BasicOzoneClientAdapterImpl(omHost,
Integer.parseInt(omPort), conf,
return new BasicOzoneClientAdapterImpl(omHost, omPort, conf,
volumeStr, bucketStr);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected void incrementCounter(Statistic statistic) {
@Override
protected OzoneClientAdapter createAdapter(Configuration conf,
String bucketStr,
String volumeStr, String omHost, String omPort,
String volumeStr, String omHost, int omPort,
boolean isolatedClassloader) throws IOException {

this.storageStatistics =
Expand All @@ -99,8 +99,7 @@ protected OzoneClientAdapter createAdapter(Configuration conf,
storageStatistics);

} else {
return new OzoneClientAdapterImpl(omHost,
Integer.parseInt(omPort), conf,
return new OzoneClientAdapterImpl(omHost, omPort, conf,
volumeStr, bucketStr, storageStatistics);
}
}
Expand Down

0 comments on commit 3bba808

Please sign in to comment.