Skip to content

Commit

Permalink
Replace deprecated GnuParser with DefaultParser (#2498)
Browse files Browse the repository at this point in the history
The class GnuParser is deprecated. Replace usages with DefaultParser
instead.

Part of #2443.
  • Loading branch information
lbschanno authored Sep 4, 2024
1 parent 3346336 commit f017ce7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormat;
import org.apache.accumulo.hadoop.mapreduce.AccumuloOutputFormat;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.ParseException;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -341,7 +342,7 @@ protected int launchErrorsJob(Job job, Configuration conf)
* Goes through the arguments and attempts to add relevant values to the configuration
*/
private void _configure(String[] args) {
GnuParser parser = new GnuParser();
CommandLineParser parser = new DefaultParser();
CommandLine cmd;
try {
cmd = parser.parse(new MetricsOptions(), args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.apache.accumulo.core.data.Range;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.ParseException;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -46,7 +46,7 @@ public static Configuration configure(String[] args, Configuration conf, Logger
}

MetricsOptions mOpts = new MetricsOptions();
CommandLine cl = new GnuParser().parse(mOpts, args);
CommandLine cl = new DefaultParser().parse(mOpts, args);
// add the file config options first
String confFiles = cl.getOptionValue("conf", "");
if (confFiles != null && !confFiles.isEmpty()) {
Expand Down

0 comments on commit f017ce7

Please sign in to comment.