Example usage for java.lang Exception getMessage

List of usage examples for java.lang Exception getMessage

Introduction

In this page you can find the example usage for java.lang Exception getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.mmone.gpdati.allotment.record.AllotmentRecordsListBuilder.java

public static void main(String[] args) {

    AllotmentLineProvvider afr = new AllotmentFileReader(
            "D:/tmp_desktop/scrigno-gpdati/FILE_DISPO__20160802.txt");
    AllotmentRecordsListBuilder arlb = new AllotmentRecordsListBuilder(afr);

    try {//from w w  w  . j av a 2 s.c  o  m
        List<AllotmentRecord> records = arlb.getGroupedRecords();
        System.out.println("Records in list " + records.size());

        if (true)
            for (AllotmentRecord record : records) {
                System.out.println("---- " + record.getCompleteKey());
            }

        //MapUtils.debugPrint(System.out , "MAP", arlb.getMappedRecords());
        //MapUtils.debugPrint(System.out , "MAP", reg);
    } catch (Exception ex) {
        SoapUI.log.info(ex.getMessage());
        Logger.getLogger(AllotmentRecordsListBuilder.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:chibi.gemmaanalysis.GeneExpressionProfileWriterCLI.java

public static void main(String[] args) {
    GeneExpressionProfileWriterCLI cli = new GeneExpressionProfileWriterCLI();
    Exception e = cli.doWork(args);
    if (e != null)
        log.error(e.getMessage());
}

From source file:com.yahoo.athenz.example.http.tls.client.HttpTLSClient.java

public static void main(String[] args) {

    // parse our command line to retrieve required input

    CommandLine cmd = parseCommandLine(args);

    final String url = cmd.getOptionValue("url");
    final String keyPath = cmd.getOptionValue("key");
    final String certPath = cmd.getOptionValue("cert");
    final String trustStorePath = cmd.getOptionValue("trustStorePath");
    final String trustStorePassword = cmd.getOptionValue("trustStorePassword");

    // we are going to setup our service private key and
    // certificate into a ssl context that we can use with
    // our http client

    try {/* ww w  . j  av  a  2s .  com*/
        KeyRefresher keyRefresher = Utils.generateKeyRefresher(trustStorePath, trustStorePassword, certPath,
                keyPath);
        SSLContext sslContext = Utils.buildSSLContext(keyRefresher.getKeyManagerProxy(),
                keyRefresher.getTrustManagerProxy());

        HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
        HttpsURLConnection con = (HttpsURLConnection) new URL(url).openConnection();
        con.setReadTimeout(15000);
        con.setDoOutput(true);
        con.connect();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            StringBuilder sb = new StringBuilder();
            String line;
            while ((line = br.readLine()) != null) {
                sb.append(line);
            }
            System.out.println("Data output: " + sb.toString());
        }

    } catch (Exception ex) {
        System.out.println("Exception: " + ex.getMessage());
        ex.printStackTrace();
        System.exit(1);
    }
}

From source file:com.genentech.chemistry.openEye.apps.SDFConformerSampler.java

/**
 * @param args//from   w  w  w  .j  a v a  2s  .  com
 */
public static void main(String... args) throws IOException { // create command line Options object
    Options options = new Options();
    Option opt = new Option(OPT_INFILE, true,
            "input file oe-supported Use .sdf|.smi to specify the file type.");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option(OPT_OUTFILE, true, "output file oe-supported. Use .sdf|.smi to specify the file type.");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option(OPT_MAX_CONFS, true, "Maximum number of conformations per input.");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option(OPT_TORSION_FILE, true, "Optional: to overwrite torsion definition file.");
    opt.setRequired(false);
    options.addOption(opt);

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exitWithHelp(options);
    }
    args = cmd.getArgs();

    if (cmd.hasOption("d")) {
        System.err.println("Start debugger and press return:");
        new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    String inFile = cmd.getOptionValue(OPT_INFILE);
    String outFile = cmd.getOptionValue(OPT_OUTFILE);
    String smartsFile = cmd.getOptionValue(OPT_TORSION_FILE);
    long maxConfs = Long.parseLong(cmd.getOptionValue(OPT_MAX_CONFS));

    SDFConformerSampler scanner = new SDFConformerSampler(smartsFile, outFile, maxConfs);

    scanner.run(inFile);
    scanner.close();
}

From source file:com.microsoft.azure.management.trafficmanager.samples.ManageSimpleTrafficManager.java

/**
 * Main entry point.//w  w  w . jav  a  2  s  . c o  m
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        //=============================================================
        // Authenticate
        //
        System.out.println("AZURE_AUTH_LOCATION=" + System.getenv("AZURE_AUTH_LOCATION"));
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
        Azure azure = Azure.authenticate(credFile).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}

From source file:CloudManagerAPITest.java

public static void main(String args[]) {
    try {//from   w w  w  .  j  a  va2  s  . c  om
        // create the object
        final CloudManagerAPI api = new CloudManagerAPI(API_TOKEN, API_VERSION);

        // create an empty targetCollection
        final JSONObject createdTargetCollection = api.createTargetCollection("myFirstTc");

        // targetCollection's id, which was created and will be modified in the following lines
        final String currentTcId = createdTargetCollection.getString("id");

        // create empty target collection
        System.out.println("\nCREATED TARGET-COLLECTION:");
        printTargetCollection(createdTargetCollection);

        // add a single target to the existing targetCollection
        System.out.println("\nCREATE TARGET");
        // create target image JSON with basic information
        final JSONObject target = new JSONObject();
        target.put("name", "target_0");
        target.put("imageUrl", EXAMPLE_IMAGE_URLS[0]);
        final JSONObject createdTarget = api.addTarget(currentTcId, target);
        printTarget(createdTarget);

        // add multiple targets at once to existing targetCollection
        final JSONArray targets = new JSONArray();
        final JSONObject newTarget = new JSONObject();
        newTarget.put("name", "target_1");
        newTarget.put("imageUrl", EXAMPLE_IMAGE_URLS[1]);
        targets.put(newTarget);
        final JSONObject addedTargets = api.addTargets(currentTcId, targets);
        System.out.println("\n\nADDED TARGETS to tc " + currentTcId);
        System.out.println(addedTargets.toString());

        // generate target collection for using its targets in productive Client API
        System.out.println("\n\nGENERATING TARGET COLLECTION " + currentTcId);
        final JSONObject generatedTargetCollection = api.generateTargetCollection(currentTcId);
        System.out.println("CREATED CLOUD-ARCHIVE: " + generatedTargetCollection.getString("id"));

        // clean up
        api.deleteTargetCollection(currentTcId);
        System.out.println("deleted target collection: " + currentTcId);
    } catch (final Exception e) {
        System.out.println("Unexpected exception occurred '" + e.getMessage() + "'");
        e.printStackTrace();
    }
}

From source file:com.genentech.chemistry.openEye.apps.SDFMolSeparator.java

/**
 * @param args/*from w w w  . j a  va2s .c o m*/
 */
public static void main(String... args) throws IOException { // create command line Options object
    Options options = new Options();
    Option opt = new Option(OPT_INFILE, true,
            "input file oe-supported Use .sdf|.smi to specify the file type.");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option(OPT_OUTFILE, true, "output file oe-supported. Use .sdf|.smi to specify the file type.");
    opt.setRequired(true);
    options.addOption(opt);

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exitWithHelp(options);
    }
    args = cmd.getArgs();

    if (cmd.hasOption("d")) {
        System.err.println("Start debugger and press return:");
        new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    String inFile = cmd.getOptionValue(OPT_INFILE);
    String outFile = cmd.getOptionValue(OPT_OUTFILE);
    SDFMolSeparator separator = new SDFMolSeparator(outFile);

    try {
        separator.run(inFile);

    } catch (IndexOutOfBoundsException iie) {
        System.err.println(iie.toString());
        exitWithHelp(options);
    } finally {
        separator.close();
    }

}

From source file:com.interacciones.mxcashmarketdata.driver.util.AppropriateFormat.java

public static void main(String[] args) throws Throwable {
    init(args);/*from w w  w  . j  a  v  a2 s  . com*/

    long time = System.currentTimeMillis();
    //for (;;) {
    try {
        //read
        file = new File(source);
        is = new FileInputStream(file);
        isr = new InputStreamReader(is);
        br = new BufferedReader(isr);
        //write
        filewrite = new File(destination);
        fos = new FileOutputStream(filewrite);
        bos = new BufferedOutputStream(fos);

        int data = 0;
        int count = 0;

        StringBuffer message = new StringBuffer();
        while (data != -1) {
            data = br.read();
            message.append((char) data);
            count++;
            if (data == 10) {
                transform(message);
                count = 0;
                message.delete(INIT_ASCII, message.length());
            }
        }
    } catch (Exception e) {
        LOGGER.error("Warning " + e.getMessage());
        e.printStackTrace();
    } finally {
        close();
    }
    //}
    time = System.currentTimeMillis() - time;
    LOGGER.info("Time " + time);
}

From source file:eu.delving.x3ml.X3MLCommandLine.java

public static void main(String[] args) {
    Option xml = new Option("xml", true, "XML input records: -xml input.xml (@ = stdin)");
    xml.setRequired(true);/*  w  w w. j av a 2s .c  o m*/
    Option x3ml = new Option("x3ml", true, "X3ML mapping definition: -x3ml mapping.x3ml (@ = stdin)");
    x3ml.setRequired(true);
    Option rdf = new Option("rdf", true, "The RDF output file name: -rdf output.rdf");
    Option policy = new Option("policy", true, "The value policy file: -policy policy.xml");
    Option rdfFormat = new Option("format", true,
            "Output format: -format application/n-triples, text/turtle, application/rdf+xml (default)");
    Option validate = new Option("validate", false, "Validate X3ML v1.0 using XSD");
    Option uuidTestSize = new Option("uuidTestSize", true,
            "Create a test UUID generator of the given size. Default is UUID from operating system");
    options.addOption(rdfFormat).addOption(rdf).addOption(x3ml).addOption(xml).addOption(policy)
            .addOption(validate).addOption(uuidTestSize);
    try {
        CommandLine cli = PARSER.parse(options, args);
        int uuidTestSizeValue = -1;
        String uuidTestSizeString = cli.getOptionValue("uuidTestSize");
        if (uuidTestSizeString != null) {
            uuidTestSizeValue = Integer.parseInt(uuidTestSizeString);
        }
        go(cli.getOptionValue("xml"), cli.getOptionValue("x3ml"), cli.getOptionValue("policy"),
                cli.getOptionValue("rdf"), cli.getOptionValue("format"), cli.hasOption("validate"),
                uuidTestSizeValue);
    } catch (Exception e) {
        error(e.getMessage());
    }

}

From source file:com.qwazr.Qwazr.java

public static void main(String[] args) {
    try {//from w  w  w.  j  a  v a  2 s  . c  o  m
        start(new QwazrConfiguration());
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        System.exit(1);
    }
}