Skip to content

Commit

Permalink
HBASE-25611 ExportSnapshot chmod flag uses value as decimal (#3003)
Browse files Browse the repository at this point in the history
Signed-off-by: Wellington Chevreuil <[email protected]>
  • Loading branch information
petersomogyi committed Mar 2, 2021
1 parent af2d31d commit 30ba8b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,24 @@ protected void addOptWithArg(String shortOpt, String longOpt, String description
}

public int getOptionAsInt(CommandLine cmd, String opt, int defaultValue) {
return getOptionAsInt(cmd, opt, defaultValue, 10);
}

public int getOptionAsInt(CommandLine cmd, String opt, int defaultValue, int radix) {
if (cmd.hasOption(opt)) {
return Integer.parseInt(cmd.getOptionValue(opt));
return Integer.parseInt(cmd.getOptionValue(opt), radix);
} else {
return defaultValue;
}
}

public long getOptionAsLong(CommandLine cmd, String opt, int defaultValue) {
return getOptionAsLong(cmd, opt, defaultValue, 10);
}

public long getOptionAsLong(CommandLine cmd, String opt, int defaultValue, int radix) {
if (cmd.hasOption(opt)) {
return Long.parseLong(cmd.getOptionValue(opt));
return Long.parseLong(cmd.getOptionValue(opt), radix);
} else {
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ protected void processOptions(CommandLine cmd) {
mappers = getOptionAsInt(cmd, Options.MAPPERS.getLongOpt(), mappers);
filesUser = cmd.getOptionValue(Options.CHUSER.getLongOpt(), filesUser);
filesGroup = cmd.getOptionValue(Options.CHGROUP.getLongOpt(), filesGroup);
filesMode = getOptionAsInt(cmd, Options.CHMOD.getLongOpt(), filesMode);
filesMode = getOptionAsInt(cmd, Options.CHMOD.getLongOpt(), filesMode, 8);
bandwidthMB = getOptionAsInt(cmd, Options.BANDWIDTH.getLongOpt(), bandwidthMB);
overwrite = cmd.hasOption(Options.OVERWRITE.getLongOpt());
// And verifyChecksum and verifyTarget with values read from old args in processOldArgs(...).
Expand Down

0 comments on commit 30ba8b0

Please sign in to comment.