Skip to content

Commit

Permalink
Revert "closes #122 - updating Apache Commons CLI usage to avoid depr…
Browse files Browse the repository at this point in the history
…ecated classes"

This reverts commit 93e9f86.
  • Loading branch information
psybers committed Jun 28, 2017
1 parent 826d33d commit 51b5bb7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/java/boa/BoaMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.PosixParser;

/**
* The main entry point for Boa-related tools.
Expand All @@ -46,7 +46,7 @@ public static void main(final String[] args) throws IOException {
printHelp(options, null);
return;
} else {
final CommandLine cl = new DefaultParser().parse(options, new String[] { args[0] });
final CommandLine cl = new PosixParser().parse(options, new String[] { args[0] });
final String[] tempargs = new String[args.length - 1];
System.arraycopy(args, 1, tempargs, 0, args.length - 1);

Expand Down
6 changes: 3 additions & 3 deletions src/java/boa/compiler/BoaCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
import org.stringtemplate.v4.ST;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;

import org.scannotation.ClasspathUrlFinder;
Expand Down Expand Up @@ -383,7 +383,7 @@ private static CommandLine processCommandLineOptions(final String[] args) {

final CommandLine cl;
try {
cl = new DefaultParser().parse(options, args);
cl = new PosixParser().parse(options, args);
} catch (final org.apache.commons.cli.ParseException e) {
System.err.println(e.getMessage());
new HelpFormatter().printHelp("Boa Compiler", options);
Expand Down Expand Up @@ -422,7 +422,7 @@ private static CommandLine processParseCommandLineOptions(final String[] args) {

final CommandLine cl;
try {
cl = new DefaultParser().parse(options, args);
cl = new PosixParser().parse(options, args);
} catch (final org.apache.commons.cli.ParseException e) {
printHelp(options, e.getMessage());
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/java/boa/datagen/BoaGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import java.io.IOException;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;

import boa.datagen.forges.github.GetGithubRepoByUser;
import boa.datagen.forges.github.LocalGitSequenceGenerator;
Expand All @@ -43,7 +43,7 @@ public static void main(final String[] args) throws IOException {

final CommandLine cl;
try {
cl = new DefaultParser().parse(options, args);
cl = new PosixParser().parse(options, args);
} catch (final org.apache.commons.cli.ParseException e) {
System.err.println(e.getMessage());
new HelpFormatter().printHelp("BoaCompiler", options);
Expand Down
5 changes: 3 additions & 2 deletions src/java/boa/evaluator/BoaEvaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
import java.util.UUID;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.io.FileUtils;

import boa.BoaMain;
Expand Down Expand Up @@ -74,7 +75,7 @@ public static void main(final String[] args) {
printHelp(options, null);
return;
} else {
final CommandLine cl = new DefaultParser().parse(options, args);
final CommandLine cl = new PosixParser().parse(options, args);

if (cl.hasOption('i') && cl.hasOption('d')) {
final BoaEvaluator evaluator;
Expand Down
35 changes: 17 additions & 18 deletions src/java/boa/runtime/BoaRunner.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright 2017, Anthony Urso, Hridesh Rajan, Robert Dyer,
* Iowa State University of Science and Technology
* and Bowling Green State University
* Copyright 2014, Anthony Urso, Hridesh Rajan, Robert Dyer,
* and Iowa State University of Science and Technology
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,11 +19,11 @@
import java.io.IOException;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
Expand Down Expand Up @@ -106,21 +105,21 @@ public Job job(final Path[] ins, final Path out) throws IOException {
static {
options.addOption("p", "profile", false, "if true, profiles the execution of 1 map task");
options.addOption("b", "block", false, "if true, wait for job to finish and show status");
options.addOption(Option.builder("j").longOpt("job")
.desc("sets the MySql ID to update with this job's status")
options.addOption(OptionBuilder.withLongOpt("job")
.withDescription("sets the MySql ID to update with this job's status")
.hasArg()
.argName("ID")
.build());
options.addOption(Option.builder("a").longOpt("ast")
.desc("which INPUT to use for ASTs")
.withArgName("ID")
.create("j"));
options.addOption(org.apache.commons.cli.OptionBuilder.withLongOpt("ast")
.withDescription("which INPUT to use for ASTs")
.hasArg()
.argName("INPUT")
.build());
options.addOption(Option.builder("c").longOpt("comments")
.desc("which INPUT to use for comments")
.withArgName("INPUT")
.create("a"));
options.addOption(org.apache.commons.cli.OptionBuilder.withLongOpt("comments")
.withDescription("which INPUT to use for comments")
.hasArg()
.argName("INPUT")
.build());
.withArgName("INPUT")
.create("c"));
}

protected static Options getOptions() { return options; }
Expand All @@ -129,7 +128,7 @@ public static CommandLine parseArgs(String[] args, String usage) {
CommandLine line = null;

try {
line = new DefaultParser().parse(options, args);
line = new PosixParser().parse(options, args);
} catch (ParseException exp) {
System.err.println(exp.getMessage());
printHelp(usage);
Expand Down

0 comments on commit 51b5bb7

Please sign in to comment.