List of usage examples for java.lang Throwable getMessage
public String getMessage()
From source file:Main.java
public static void main(String[] argv) { Throwable t = new Exception("from java2s.com"); System.out.println(t.getMessage()); }
From source file:com.bc.fiduceo.ingest.IngestionToolMain.java
public static void main(String[] args) throws ParseException, IOException, SQLException { final IngestionTool ingestionTool = new IngestionTool(); if (args.length == 0) { ingestionTool.printUsageTo(System.err); return;//from w ww. ja v a 2 s .co m } final CommandLineParser parser = new PosixParser(); final CommandLine commandLine = parser.parse(IngestionTool.getOptions(), args); if (commandLine.hasOption("h") || commandLine.hasOption("--help")) { ingestionTool.printUsageTo(System.out); return; } try { ingestionTool.run(commandLine); } catch (Throwable e) { FiduceoLogger.getLogger().severe(e.getMessage()); e.printStackTrace(); System.exit(-1); } }
From source file:com.bc.fiduceo.matchup.MatchupToolMain.java
public static void main(String[] args) throws ParseException, IOException, SQLException, InvalidRangeException { final MatchupTool matchupTool = new MatchupTool(); if (args.length == 0) { matchupTool.printUsageTo(System.err); return;//from w w w. j a v a 2s. c om } final CommandLineParser parser = new PosixParser(); final CommandLine commandLine = parser.parse(MatchupTool.getOptions(), args); if (commandLine.hasOption("h") || commandLine.hasOption("--help")) { matchupTool.printUsageTo(System.err); return; } try { matchupTool.run(commandLine); } catch (Throwable e) { FiduceoLogger.getLogger().severe(e.getMessage()); e.printStackTrace(); System.exit(-1); } }
From source file:com.moss.appsnap.keeper.KeeperMain.java
public static void main(String[] args) throws Throwable { BasicConfigurator.resetConfiguration(); BasicConfigurator.configure();//from www . ja va 2 s . co m Log log = LogFactory.getLog(KeeperMain.class); try { new Keeper(new Url(args[0])); } catch (Throwable e) { log.error("Error launching keeper: " + e.getMessage(), e); throw e; } }
From source file:MethodTroubleReturns.java
public static void main(String... args) { try {//from w ww . j av a 2 s. c o m MethodTroubleReturns mtr = new MethodTroubleReturns(); Class<?> c = mtr.getClass(); Method m = c.getDeclaredMethod("drinkMe", int.class); m.invoke(mtr, -1); // production code should handle these exceptions more gracefully } catch (InvocationTargetException x) { Throwable cause = x.getCause(); System.err.format("drinkMe() failed: %s%n", cause.getMessage()); } catch (Exception x) { x.printStackTrace(); } }
From source file:bixo.tools.RunUrlNormalizerTool.java
/** * @param args/*from w w w . jav a2 s. c o m*/ */ public static void main(String[] args) { String curUrl = null; try { List<String> lines = FileUtils.readLines(new File(args[0])); BaseUrlNormalizer urlNormalizer = new SimpleUrlNormalizer(); for (String url : lines) { curUrl = url; String normalized = urlNormalizer.normalize(curUrl); if (!normalized.equalsIgnoreCase(curUrl)) { System.out.println(curUrl + " ==> " + normalized); } } } catch (Throwable t) { System.err.println("Exception while processing URLs: " + t.getMessage()); System.err.println("Current url: " + curUrl); t.printStackTrace(System.err); System.exit(-1); } }
From source file:com.javaetmoi.elasticsearch.musicbrainz.batch.IndexBatchMain.java
public static void main(String... args) { AbstractApplicationContext context = null; try {//ww w . j a v a 2s . c o m context = new ClassPathXmlApplicationContext(new String[] { "com/javaetmoi/elasticsearch/musicbrainz/batch/applicationContext-datasource.xml", "com/javaetmoi/elasticsearch/musicbrainz/batch/applicationContext-elasticsearch.xml", "com/javaetmoi/elasticsearch/musicbrainz/batch/applicationContext-batch.xml" }); JobLauncher jobLauncher = context.getBean(JobLauncher.class); Job musicAlbumJob = context.getBean("musicAlbumJob", Job.class); jobLauncher.run(musicAlbumJob, new JobParameters()); } catch (Throwable e) { String message = "Job Terminated in error: " + e.getMessage(); LOG.error(message, e); systemExiter.exit(exitCodeMapper.intValue(ExitStatus.FAILED.getExitCode())); } finally { if (context != null) { context.close(); } } systemExiter.exit(exitCodeMapper.intValue(ExitStatus.COMPLETED.getExitCode())); }
From source file:com.mobius.software.mqtt.performance.controller.ControllerRunner.java
public static void main(String[] args) { try {//from w w w.j ava 2 s. c o m /*URI baseURI = URI.create(args[0].replace("-baseURI=", "")); configFile = args[1].replace("-configFile=", "");*/ String userDir = System.getProperty("user.dir"); System.out.println("user.dir: " + userDir); setConfigFilePath(userDir + "/config.properties"); Properties prop = new Properties(); prop.load(new FileInputStream(configFile)); System.out.println("properties loaded..."); String hostname = prop.getProperty("hostname"); Integer port = Integer.parseInt(prop.getProperty("port")); URI baseURI = new URI(null, null, hostname, port, null, null, null); configureConsoleLogger(); System.out.println("starting http server..."); JerseyServer server = new JerseyServer(baseURI); System.out.println("http server started"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("press any key to stop: "); br.readLine(); server.terminate(); } catch (Throwable e) { logger.error("AN ERROR OCCURED: " + e.getMessage()); e.printStackTrace(); } finally { System.exit(0); } }
From source file:esg.common.QuickHash.java
public static void main(String[] args) { try {// www . ja v a2 s .c o m String val = null; String hash = null; QuickHash quickHash = new QuickHash(args[1]); for (int i = 0; i < 1; i++) { val = args[0] + (i % 1); System.out.print(val + " -> "); long start = System.currentTimeMillis(); hash = quickHash.sum(val); System.out.println(hash + " -> t=" + (System.currentTimeMillis() - start)); } } catch (Throwable t) { System.out.println(t.getMessage()); } }
From source file:eu.stratosphere.client.WebFrontend.java
/** * Main method. accepts a single parameter, which is the config directory. * /* w w w .j av a2s . c o m*/ * @param args * The parameters to the entry point. */ public static void main(String[] args) { try { // get the config directory first String configDir = null; if (args.length >= 2 && args[0].equals("-configDir")) { configDir = args[1]; } if (configDir == null) { System.err.println( "Error: Configuration directory must be specified.\nWebFrontend -configDir <directory>\n"); System.exit(1); return; } // load the global configuration GlobalConfiguration.loadConfiguration(configDir); Configuration config = GlobalConfiguration.getConfiguration(); // add stratosphere base dir to config config.setString(ConfigConstants.STRATOSPHERE_BASE_DIR_PATH_KEY, configDir + "/.."); // get the listening port int port = config.getInteger(ConfigConstants.WEB_FRONTEND_PORT_KEY, ConfigConstants.DEFAULT_WEBCLIENT_PORT); // start the server WebInterfaceServer server = new WebInterfaceServer(config, port); LOG.info("Starting web frontend server on port " + port + '.'); server.start(); server.join(); } catch (Throwable t) { LOG.error("Unexpected exception: " + t.getMessage(), t); } }