Search in sources :

Example 16 with MissingArgumentException

use of org.apache.commons.cli.MissingArgumentException in project onebusaway-gtfs-modules by OneBusAway.

the class GtfsMergerMain method run.

/**
 ***************************************************************************
 * {@link Runnable} Interface
 ***************************************************************************
 */
public void run(String[] args) throws IOException {
    if (needsHelp(args)) {
        printHelp();
        System.exit(0);
    }
    try {
        CommandLine cli = _parser.parse(_options, args, true);
        runApplication(cli, args);
    } catch (MissingOptionException ex) {
        System.err.println("Missing argument: " + ex.getMessage());
        printHelp();
    } catch (MissingArgumentException ex) {
        System.err.println("Missing argument: " + ex.getMessage());
        printHelp();
    } catch (UnrecognizedOptionException ex) {
        System.err.println("Unknown argument: " + ex.getMessage());
        printHelp();
    } catch (AlreadySelectedException ex) {
        System.err.println("Argument already selected: " + ex.getMessage());
        printHelp();
    } catch (ParseException ex) {
        System.err.println(ex.getMessage());
        printHelp();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : CommandLine(org.apache.commons.cli.CommandLine) MissingArgumentException(org.apache.commons.cli.MissingArgumentException) AlreadySelectedException(org.apache.commons.cli.AlreadySelectedException) ParseException(org.apache.commons.cli.ParseException) MissingOptionException(org.apache.commons.cli.MissingOptionException) UnrecognizedOptionException(org.apache.commons.cli.UnrecognizedOptionException) UnrecognizedOptionException(org.apache.commons.cli.UnrecognizedOptionException) IOException(java.io.IOException) MissingOptionException(org.apache.commons.cli.MissingOptionException) AlreadySelectedException(org.apache.commons.cli.AlreadySelectedException) ParseException(org.apache.commons.cli.ParseException) MissingArgumentException(org.apache.commons.cli.MissingArgumentException)

Aggregations

MissingArgumentException (org.apache.commons.cli.MissingArgumentException)16 CommandLine (org.apache.commons.cli.CommandLine)14 Options (org.apache.commons.cli.Options)11 GnuParser (org.apache.commons.cli.GnuParser)9 Option (org.apache.commons.cli.Option)5 ParseException (org.apache.commons.cli.ParseException)4 UnrecognizedOptionException (org.apache.commons.cli.UnrecognizedOptionException)4 HashSet (java.util.HashSet)3 Set (java.util.Set)3 CommandLineParser (org.apache.commons.cli.CommandLineParser)3 MissingOptionException (org.apache.commons.cli.MissingOptionException)3 IOException (java.io.IOException)2 AlreadySelectedException (org.apache.commons.cli.AlreadySelectedException)2 DefaultParser (org.apache.commons.cli.DefaultParser)2 ResourceManagerAdministrationProtocol (org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 GeneralSecurityException (java.security.GeneralSecurityException)1 ArrayList (java.util.ArrayList)1