Example usage for org.apache.commons.cli MissingOptionException toString

List of usage examples for org.apache.commons.cli MissingOptionException toString

Introduction

In this page you can find the example usage for org.apache.commons.cli MissingOptionException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:jamm.tools.JammCleaner.java

/**
 * Our main method/*from ww  w . j  a  v a2s  .  c  o  m*/
 *
 * @param argv command line arguments
 */
public static final void main(String argv[]) {
    Options opts = getOptions();
    CommandLine cmdl = null;
    Parser parser = new GnuParser();

    boolean sane = true;

    BasicConfigurator.configure();

    try {
        cmdl = parser.parse(opts, argv);
    } catch (MissingOptionException e) {
        LOG.error("Missing required options." + e.toString());
        sane = false;
    } catch (MissingArgumentException e) {
        LOG.error("Missing required Arguments." + e.toString());
        sane = false;
    } catch (ParseException e) {
        LOG.error("Error parsing command line", e);
        sane = false;
    }

    // Load properties first
    loadProperties();
    // Allow command line args to override properties file
    parseArgs(opts, cmdl);

    sane = sane && sanityCheck();
    if (!sane) {
        printHelp(opts);
        System.exit(1);
    }

    AccountCleaner ac = new AccountCleaner();
    ac.cleanUp();
    DomainCleaner dc = new DomainCleaner();
    dc.cleanUp();
}