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.bt.aloha.mockphones.Main.java

public static void main(String[] args) {
    start(args);/*from  w w  w  .  j  a v a2  s  .  com*/
    try {
        while (true) {
            Thread.sleep(1000);
        }
    } catch (Exception e) {
        log.error("Exception in main: " + e.getMessage(), e);
    }
}

From source file:com.sm.replica.TestReplicaClient.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-url", "-times" };
    String[] defaults = new String[] { "campaigns", "localhost:7320", "3" };
    String[] paras = getOpts(args, opts, defaults);
    String store = paras[0];//w  ww  .j a va2 s  . co  m
    String url = paras[1];
    int times = Integer.valueOf(paras[2]);
    MockClient client = new MockClient(url, store);

    for (int i = 0; i < times; i++) {
        try {
            Header header = new Header(store, i, (byte) 0, 1);
            ParaList paraList = createParaList(1, i);
            Request request = new Request(header, paraList.toBytes());
            Response resp = client.sendRequest(request);
            if (resp.getPayload() instanceof ParaList) {
                ParaList pList = (ParaList) resp.getPayload();
                logger.info(resp.toString() + " pList " + pList.getLists().size() + " error " + errorNo(pList));
            } else
                logger.info(
                        "class " + resp.getPayload().getClass().getName() + " " + resp.getPayload().toString());
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        }

    }
    //client.close();

}

From source file:TestJDBCDriverInstallation_MySQL.java

public static void main(String[] args) {
    System.out.println("TestJDBCDriverInstallation_MySQL begin");
    try {//from www . jav  a2  s.  c om
        String className = "org.gjt.mm.mysql.Driver";
        Class driverObject = Class.forName(className);
        System.out.println("driverObject=" + driverObject);
        System.out.println("your installation of JDBC Driver OK.");
    } catch (Exception e) {
        // your installation of JDBC Driver Failed
        System.out.println("Failed: JDBC Driver Error: " + e.getMessage());
    }

    System.out.println("TestJDBCDriverInstallation_MySQL end");
}

From source file:com.alibaba.cobar.manager.test.ConnectionTest.java

/**
 * @param args//from w  ww . ja  v  a 2 s .  c o  m
 */
public static void main(String[] args) {
    try {
        BasicDataSource ds = new BasicDataSource();
        ds.setUsername("test");
        ds.setPassword("");
        ds.setUrl("jdbc:mysql://10.20.153.178:9066/");
        ds.setDriverClassName("com.mysql.jdbc.Driver");
        ds.setMaxActive(-1);
        ds.setMinIdle(0);
        ds.setTimeBetweenEvictionRunsMillis(600000);
        ds.setNumTestsPerEvictionRun(Integer.MAX_VALUE);
        ds.setMinEvictableIdleTimeMillis(GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
        Connection conn = ds.getConnection();

        Statement stm = conn.createStatement();
        stm.execute("show @@version");

        ResultSet rst = stm.getResultSet();
        rst.next();
        String version = rst.getString("VERSION");

        System.out.println(version);

    } catch (Exception exception) {
        System.out.println("10.20.153.178:9066   " + exception.getMessage() + exception);
    }
}

From source file:com.envirover.spl.SPLGroundControl.java

public static void main(String[] args) {
    try {//from w w  w  . j  av  a 2  s  .  c om
        SPLDaemon daemon = new SPLDaemon();

        daemon.init(new SPLDaemonContext(args));

        daemon.start();

        System.out.println("Enter 'stop' to exit the program.");

        Scanner scanner = new Scanner(System.in);

        String str;
        while (!(str = scanner.next()).equalsIgnoreCase("stop")) {
            //Just echo the user input for now.
            System.out.println(str);
        }

        System.out.println("Exiting...");

        scanner.close();

        daemon.stop();
        daemon.destroy();

        System.out.println("Done.");
        System.exit(0);
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }
}

From source file:game.rushhour.RushHourDb.java

public static void main(String[] args) {
    RushHourDb rushHourDb = null;/*from w w w  .  ja  va  2 s.  c  o m*/
    try {
        rushHourDb = new RushHourDb();

        rushHourDb.close();
    } catch (Exception e) {
        log.error("Error in RushHourDb.main: " + e.getMessage());
        rushHourDb.close();
    }
}

From source file:net.ripe.rpki.validator.cli.Main.java

public static void main(String[] args) {
    try {/*from  w w w.  ja va2s  .c om*/
        setUpLogging();
        new Main().run(args);
        System.exit(0);
    } catch (Exception e) {
        getLogger().error(e.getMessage());
        System.exit(1);
    }
}

From source file:org.rotarysource.standalone.ServerShellMain.java

public static void main(String[] args) throws Exception {
    try {//from   ww w  .  j  a  va2 s. c  o m
        log.info("System properties information : file.encoding=" + Charset.defaultCharset().name());
        new ServerShellMain();
    } catch (Exception t) {
        log.error("Error starting server shell: " + t.getMessage(), t);
        System.exit(-1);
    }
}

From source file:com.sm.test.TestClient.java

public static void main(String[] args) {
    ccf = ClusterClientFactory.connect(HOST_CONNECT_URL, STORENAME);
    client = ccf.getDefaultStore();/*from  ww w  . j  av  a  2  s .c  o  m*/
    while (true) {
        try {
            long time = System.currentTimeMillis() / 1000;
            ByteArrayConverter converter = new ByteArrayConverter();
            Key<ByteArray> key = Key.createKey(new ByteArray("1.abcdef".getBytes()));
            Bar bar = new Bar();
            client.put(key, new ByteArray("FooBar".getBytes()));
            Value<ByteArray> value = client.get(key);
            System.out.println("" + new String(value.getData().get()));
            try {
                Thread.sleep(3000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
        if (false)
            break;
    }
    client.close();
    ccf.close();
}

From source file:ch.qos.logback.decoder.cli.Main.java

/**
 * Entry point for command-line interface
 *
 * @param args the command-line parameters
 *///  ww  w  .  j  av  a 2s  .  c  o m
static public void main(String[] args) {
    MainArgs mainArgs = null;
    try {
        mainArgs = new MainArgs(args);

        // handle help and version queries
        if (mainArgs.queriedHelp()) {
            mainArgs.printUsage();
        } else if (mainArgs.queriedVersion()) {
            mainArgs.printVersion();

            // normal processing
        } else {
            if (mainArgs.isDebugMode()) {
                enableVerboseLogging();
            }

            BufferDecoder decoder = new BufferDecoder();
            decoder.setLayoutPattern(mainArgs.getLayoutPattern());

            BufferedReader reader = null;
            if (StringUtils.defaultString(mainArgs.getInputFile()).isEmpty()) {
                reader = new BufferedReader(new InputStreamReader(System.in));
            } else {
                reader = new BufferedReader(new FileReader(mainArgs.getInputFile()));
            }

            decoder.decode(reader);
        }
    } catch (Exception e) {
        System.err.println("error: " + e.getMessage());
    }
}