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:io.urmia.cli.admin.AdminMain.java

public static void main(String[] args) throws Exception {
    final AdminCommand line = parseArgs(args);
    if (line == null)
        return;//  ww w.j av a 2  s .c om

    final CuratorFramework client = getZkClient(line.getZkUrl());
    final NamingService ns = new ZkNamingServiceImpl(client, line.getAvailabilityZone());
    final NamingAdminFacade facade = new DefaultNamingAdminFacadeImpl(ns);

    try {
        facade.apply(line);
    } catch (Exception e) {
        System.err.println("error: " + e.getMessage());
        System.exit(-1);
    }
}

From source file:mapas.Mapas.java

public static void main(String[] args) throws Exception {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    factory.setPassword("test");
    factory.setUsername("test");
    final Connection connection = factory.newConnection();

    final Channel channel = connection.createChannel();

    channel.queueDeclare(TASK_QUEUE_NAME, true, false, false, null);
    System.out.println(" [*] Waiting for messages. To exit press CTRL+C");

    channel.basicQos(1);/*  w  w  w.j  a v  a  2 s. c  om*/

    final Consumer consumer = new DefaultConsumer(channel) {
        @Override
        public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties,
                byte[] body) throws IOException {
            String message = new String(body, "UTF-8");

            System.out.println(" [x] Received '" + message + "'");
            try {
                doWork(message);
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
            System.out.println(" [x] Done");
            channel.basicAck(envelope.getDeliveryTag(), false);

        }
    };
    channel.basicConsume(TASK_QUEUE_NAME, false, consumer);
}

From source file:course.CourseTest.java

public static void main(String[] args) {
    CourseTest courseTest = null;//  w w w  .  j  a v a2 s  . co  m
    try {
        courseTest = new CourseTest();
        courseTest.test();
    } catch (Exception e) {
        log.error("Error in CourseTest.main: " + e.getMessage());
    } finally {
        courseTest.end();
    }
}

From source file:edu.lternet.pasta.auditmanager.AuditCleaner.java

/**
 * @param args/*from  w  w  w  .j a  va2  s.co m*/
 */
public static void main(String[] args) {

    AuditCleaner ac = null;

    try {
        ac = new AuditCleaner();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }

    ac.doClean(60000L);

}

From source file:MainClass.java

public static void main(String args[]) {
    Connection conn = null;/*  w w  w  . j  a v a 2s .  co  m*/
    Statement stmt = null;
    ResultSet rs = null;
    try {
        conn = getConnection();
        stmt = conn.createStatement();
        String query = "select EmployeeID, LastName, FirstName from Employees";
        rs = stmt.executeQuery(query);
        while (rs.next()) {
            System.out.println(rs.getString("EmployeeID") + " " + rs.getString("LastName") + " "
                    + rs.getString("FirstName"));
        }
    } catch (Exception e) {
        // handle the exception
        e.printStackTrace();
        System.err.println(e.getMessage());
    } finally {
        try {
            rs.close();
            stmt.close();
            conn.close();
        } catch (Exception ee) {
            ee.printStackTrace();
        }
    }
}

From source file:com.dhenton9000.batik.sandbox.BatikExplorer.java

public static void main(String[] args) throws Exception {

    //simpleCreate();
    BatikExplorer p = new BatikExplorer();
    try {// www . ja  v a2s  .  c o  m
        // p.testOutBatikTranscoder();
        p.testOutPPTX();
        LOG.info("done");
        System.exit(0);
    } catch (Exception e) {
        LOG.error("MAIN ERROR: " + e.getMessage() + "\n", e);
    }
}

From source file:modelibra.ModelibraTest.java

public static void main(String[] args) {
    ModelibraTest modelibraTest = null;/*from w w w .j a  v  a 2s  .co m*/
    try {
        modelibraTest = new ModelibraTest();
        modelibraTest.test();
    } catch (Exception e) {
        log.error("Error in ModelibraTest.main: " + e.getMessage());
    } finally {
        modelibraTest.end();
    }
}

From source file:io.stpettersen.bluejpackager.BlueJPackager.java

public static void main(String[] args) {
    // Create the command line parser.
    CommandLineParser parser = new DefaultParser();

    // Create the command line options.
    Options options = new Options();
    options.addOption("h", "help", false, "Display this help information and exit.");
    options.addOption("v", "version", false, "Display version information and exit.");
    options.addOption("p", "package", true, "Package string to use.");
    options.addOption("m", "mainClass", true, "Main class to use.");
    options.addOption("cp", "classPath", true, "Class path directory.");
    options.addOption("r", "root", true, "Root directory.");
    options.addOption("l", "verbose", false, "Be verbose.");

    try {/*from w w w  .ja v  a 2 s  .  co m*/
        // Parse the command line arguments.
        CommandLine cli = parser.parse(options, args);
        if (cli.hasOption("h"))
            displayUsage(options, 0);
    } catch (Exception e) {
        // Bad command line option occurred.
        System.err.println("\nError: " + e.getMessage());
        displayUsage(options, 1);
    }
}

From source file:MainClass.java

public static void main(String[] args) {
    String uri = "test.xml";
    try {/*from w  w  w.ja v a  2  s.  c  o  m*/
        bookDescDOM bd = new bookDescDOM();
        System.out.println("Parsing XML File: " + uri + "\n\n");
        DOMParser parser = new DOMParser();
        parser.setFeature("http://xml.org/sax/features/validation", true);
        parser.setFeature("http://xml.org/sax/features/namespaces", false);
        parser.parse(uri);
        Document doc = parser.getDocument();
        bd.processNode(doc, "");
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("Error: " + e.getMessage());
    }
}

From source file:interoperabilite.webservice.fluent.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>() {

            @Override//from ww  w.j  a v  a 2 s. c o m
            public void failed(final Exception ex) {
                System.out.println(ex.getMessage() + ": " + request);
            }

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

            @Override
            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();
}