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:modelibra.designer.DesignerTest.java

public static void main(String[] args) {
    DesignerTest designerTest = null;/*from w  w  w  .  java 2s.c o  m*/
    try {
        designerTest = new DesignerTest();
        if (false) {
            designerTest.initDesigner();
        }
        designerTest.test();
    } catch (Exception e) {
        log.error("Error in DesignerTest.main: " + e.getMessage());
    } finally {
        designerTest.end();
    }
}

From source file:net.cit.tetrad.rrd.batch.InputForTetradRrd.java

public static void main(String[] args) {
    try {// ww w  .ja v a2 s . c  o m
        logger.debug("InputForTetradRrd Start!!");

        // ? ?? ?
        String[] configLocations = new String[] { XML_PATH + "applicationContext_management.xml",
                "applicationContext-mongo.xml", "applicationContext_rrd.xml" };
        AbstractApplicationContext context = new ClassPathXmlApplicationContext(configLocations);

        // TetradRrd? ??   ? ?
        TetradRrdInitializer tetradRrdInitializer = (TetradRrdInitializer) context
                .getBean("tetradRrdInitializer");
        tetradRrdInitializer.input();

        logger.debug("InputForTetradRrd End!!");
    } catch (Exception e) {
        logger.info("----------------------------------------------------------------");
        logger.info(e.getMessage());
        logger.info("----------------------------------------------------------------");
    }
}

From source file:com.thinkbiganalytics.spark.cleanup.Cleanup.java

public static void main(String[] args) {
    log.info("Running Cleanup with these command line args: " + StringUtils.join(args, ","));

    if (args.length < 2) {
        System.out.println("Expected command line args: <hive-schema-name> <hive-table-name>");
        System.exit(1);//from w w  w  . j  a v a2s  .co m
    }

    try {
        ApplicationContext ctx = new AnnotationConfigApplicationContext("com.thinkbiganalytics.spark");
        Cleanup app = ctx.getBean(Cleanup.class);
        app.setArguments(args[0], args[1]);
        app.doCleanup();
    } catch (Exception e) {
        log.error("Failed to perform cleanup: {}", e.getMessage());
        System.exit(1);
    }

    log.info("Cleanup has finished.");
}

From source file:com.mycompany.hdp.hdp.java

public static void main(String[] args) throws IOException, FileNotFoundException, URISyntaxException {
    Configuration configuration = new Configuration();
    configuration.set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
    configuration.set("fs.file.impl", org.apache.hadoop.fs.LocalFileSystem.class.getName());
    hdfs = FileSystem.get(new URI("hdfs://104.236.110.203:9000"), configuration);
    date = dt.toString().replaceAll(" ", "_").replaceAll(":", "-");
    crawl("iphone");
    crawl("ipad");
    crawl("samsung phone");
    crawl("samsung tab");
    if (success > 0) {
        try {/*from w  ww  .j  ava2s .c  o  m*/
            FileUtils.deleteDirectory(new File("data"));
            System.out.println("DONE");

        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    } else {
        System.out.println("Something Went Wrong Try to Fix the Error:::::");
    }

}

From source file:io.cloudslang.lang.cli.SlangBootstrap.java

public static void main(String[] args) throws IOException {
    try {/*from w  ww  . ja v  a2  s. co m*/
        loadUserProperties();
    } catch (Exception ex) {
        System.out.println("Error occurred while loading user configuration: " + ex.getMessage());
        ex.printStackTrace();
    }
    System.out.println("Loading..");
    Bootstrap.main(args);
}

From source file:io.aos.protocol.http.httpcommon.FluentAsync.java

public static void main(String... args) throws Exception {
    // Use pool of two threads
    ExecutorService threadpool = Executors.newFixedThreadPool(2);
    Async async = Async.newInstance().use(threadpool);

    Request[] requests = new Request[] { Request.Get("http://www.google.com/"),
            Request.Get("http://www.yahoo.com/"), Request.Get("http://www.apache.com/"),
            Request.Get("http://www.apple.com/") };

    Queue<Future<Content>> queue = new LinkedList<Future<Content>>();
    // Execute requests asynchronously
    for (final Request request : requests) {
        Future<Content> future = async.execute(request, new FutureCallback<Content>() {

            public void failed(final Exception ex) {
                System.out.println(ex.getMessage() + ": " + request);
            }/*from ww  w  .  j  a va2s.  co m*/

            public void completed(final Content content) {
                System.out.println("Request completed: " + request);
            }

            public void cancelled() {
            }

        });
        queue.add(future);
    }

    while (!queue.isEmpty()) {
        Future<Content> future = queue.remove();
        try {
            future.get();
        } catch (ExecutionException ex) {
        }
    }
    System.out.println("Done");
    threadpool.shutdown();
}

From source file:grails.util.RunTests.java

public static void main(String[] args) {
    int exitCode = 0;
    try {//w ww. j a v a  2s . co m
        log.info("Bootstrapping Grails from classpath");
        ConfigurableApplicationContext appCtx = (ConfigurableApplicationContext) GrailsUtil
                .bootstrapGrailsFromClassPath();
        GrailsApplication application = (GrailsApplication) appCtx.getBean(GrailsApplication.APPLICATION_ID);

        Class[] allClasses = application.getAllClasses();
        log.debug("Going through [" + allClasses.length + "] classes");
        TestSuite s = new TestSuite();
        for (int i = 0; i < allClasses.length; i++) {
            Class clazz = allClasses[i];
            if (TestCase.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
                log.debug("Adding test [" + clazz.getName() + "]");
                s.addTest(new GrailsTestSuite(appCtx, clazz));
            } else {
                log.debug("[" + clazz.getName() + "] is not a test case.");
            }
        }
        String[] beanNames = appCtx.getBeanNamesForType(PersistenceContextInterceptor.class);
        PersistenceContextInterceptor interceptor = null;
        if (beanNames.length > 0) {
            interceptor = (PersistenceContextInterceptor) appCtx.getBean(beanNames[0]);
        }

        try {
            if (interceptor != null) {
                interceptor.init();
            }
            TestResult r = TestRunner.run(s);
            exitCode = r.errorCount() + r.failureCount();
            if (exitCode > 0) {
                System.err.println("Tests failed!");
            }
            if (interceptor != null)
                interceptor.flush();
        } finally {
            if (interceptor != null)
                interceptor.destroy();
        }
    } catch (Exception e) {
        log.error("Error executing tests: " + e.getMessage(), e);
        exitCode = 1;
    } finally {
        System.exit(exitCode);
    }
}

From source file:com.dhenton9000.jersey.client.JerseyClientExplorer.java

public static void main(String[] args) {
    try {//from   w  w  w  .j  a v a 2  s . c o m
        (new JerseyClientExplorer()).doErrorThing();
    } catch (Exception err) {

        LOG.error("main error " + err.getClass().getName() + " " + err.getMessage());

    }
}

From source file:dk.dbc.DevelMain.java

public static void main(String[] args) {
    try {// ww  w .  j av a 2 s  .co m
        System.setProperty("logback.configurationFile", LOGBACK_XML);
        new DevelMain().run(new String[] { "server", YAML_FILE_NAME });
    } catch (Exception ex) {
        System.err.println(ex.getMessage());
        System.exit(1);
    }
}

From source file:com.oeg.oops.Main.java

public static void main(String[] args) {
    System.out.println("Hello, World");

    for (int i = 0; i < args.length; i++) {
        System.out.println("arg: " + args[i]);
    }/*from ww  w  . java 2  s.c o m*/
    //        if(args.length<2){
    //            System.out.println("expect 2 arguments: vocabulary-uri and output-directory");
    //        }
    //        else{
    //            String uri = args[0];
    //            String output_dir = args[1];
    if (true) {
        String uri = "https://raw.githubusercontent.com/ahmad88me/demo/master/alo.owl";
        String output_dir = "./output";

        System.out.println("uri: " + uri);
        System.out.println("output dir: " + output_dir);

        try {

            HttpClient client = HttpClientBuilder.create().build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("Accept", "application/rdf+xml");
            HttpResponse response = client.execute(request);
            if (response.getStatusLine().getStatusCode() == 200) {
                String contentType = response.getFirstHeader("Content-Type").getValue();
                System.out.println("content type: " + contentType);
            }
        } catch (Exception e) {
            System.err.println("Error while doing http get: " + " in " + uri + " " + e.getMessage());
        }

        //Vocabulary v = new Vocabulary(uri);
        //            CreateOOPSEvalPage coep = new CreateOOPSEvalPage(v);
        //            coep.createPage(output_dir);
    }

}