List of usage examples for java.lang Exception getMessage
public String getMessage()
From source file:com.ewcms.publication.PublishIntegratedTest.java
public static void main(String[] args) { try {//from w ww . j a v a 2s .c o m PublishIntegratedTest test = new PublishIntegratedTest(); test.runPublishSite(); } catch (Exception e) { logger.error(e.getMessage()); } }
From source file:com.thinkbiganalytics.spark.dataquality.checker.DataQualityChecker.java
public static void main(String[] args) { log.info("Running DataQualityChecker 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);// w w w .j a va 2 s. c o m } try { ApplicationContext ctx = new AnnotationConfigApplicationContext("com.thinkbiganalytics.spark"); DataQualityChecker app = ctx.getBean(DataQualityChecker.class); app.setArguments(args[0], args[1]); app.doDataQualityChecks(); } catch (Exception e) { log.error("Failed to perform data quality checks: {}", e.getMessage()); System.exit(1); } log.info("DataQualityChecker has finished."); }
From source file:mx.com.pixup.portal.demo.DemoDisqueraSelect.java
public static void main(String[] args) { System.out.println("BIENVENIDO A PIXUP"); System.out.println("Mantenimiento catlogo disquera"); System.out.println("Listado de disqueras"); Connection connection = null; Statement statement = null;// w ww .j a v a 2s.c o m ResultSet resultSet = null; try { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUsername("root"); dataSource.setPassword("admin"); dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/pixup"); connection = dataSource.getConnection(); statement = connection.createStatement(); String sql = "select * from disquera order by nombre desc"; resultSet = statement.executeQuery(sql); System.out.println("ID: \t NOMBRE:"); while (resultSet.next()) { Integer id = resultSet.getInt(1); String nombre = resultSet.getString(2); System.out.println(id + " \t " + nombre); } } catch (Exception e) { System.out.println("Error en el sistema, intente ms tarde!!" + e.getMessage()); } finally { if (resultSet != null) { try { resultSet.close(); } catch (Exception e) { } } if (statement != null) { try { statement.close(); } catch (Exception e) { } } if (connection != null) { try { connection.close(); } catch (Exception e) { } } } }
From source file:com.jgoetsch.eventtrader.EventTraderSpringLauncher.java
public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: " + EventTraderSpringLauncher.class.getSimpleName() + " <files>..."); System.out.println(" files - List of paths to spring bean definition xml files."); System.out.println(" Each object defined that implements Runnable will be executed"); System.out.println(" in its own thread."); } else {//from w w w.jav a 2 s . c o m AbstractApplicationContext context = new ClassPathXmlApplicationContext(args); // auto register growl notifications after all GrowlNotification objects have been instantiated // if it is found on the classpath try { Class.forName("com.jgoetsch.eventtrader.processor.GrowlNotification").getMethod("autoRegister") .invoke(null); } catch (Exception e) { log.warn("Growl not found, cannot autoRegister notifications: {}", e.getMessage()); } Map<String, Runnable> runnables = BeanFactoryUtils.beansOfTypeIncludingAncestors(context, Runnable.class); List<Thread> threads = new ArrayList<Thread>(runnables.size()); for (final Map.Entry<String, Runnable> runner : runnables.entrySet()) { final Thread th = new Thread(runner.getValue(), runner.getKey()); threads.add(th); th.start(); } // close spring context on JVM shutdown // this causes all @PreDestroy methods in the runnables to be called to allow for // them to shutdown gracefully context.registerShutdownHook(); // wait for launched threads to finish before cleaning up beans for (Thread th : threads) { try { th.join(); } catch (InterruptedException e) { } } } }
From source file:com.msd.gin.halyard.tools.HalyardUpdate.java
/** * Main of the HalyardUpdate//from w w w .ja va 2s. c o m * @param args String command line arguments * @throws Exception throws Exception in case of any problem */ public static void main(final String args[]) throws Exception { if (conf == null) conf = new Configuration(); Options options = new Options(); options.addOption(newOption("h", null, "Prints this help")); options.addOption(newOption("v", null, "Prints version")); options.addOption(newOption("s", "source_htable", "Source HBase table with Halyard RDF store")); options.addOption( newOption("q", "sparql_query", "SPARQL tuple or graph query executed to export the data")); try { CommandLine cmd = new PosixParser().parse(options, args); if (args.length == 0 || cmd.hasOption('h')) { printHelp(options); return; } if (cmd.hasOption('v')) { Properties p = new Properties(); try (InputStream in = HalyardUpdate.class .getResourceAsStream("/META-INF/maven/com.msd.gin.halyard/hbasesail/pom.properties")) { if (in != null) p.load(in); } System.out.println("Halyard Update version " + p.getProperty("version", "unknown")); return; } if (!cmd.getArgList().isEmpty()) throw new ParseException("Unknown arguments: " + cmd.getArgList().toString()); for (char c : "sq".toCharArray()) { if (!cmd.hasOption(c)) throw new ParseException("Missing mandatory option: " + c); } for (char c : "sq".toCharArray()) { String s[] = cmd.getOptionValues(c); if (s != null && s.length > 1) throw new ParseException("Multiple values for option: " + c); } SailRepository rep = new SailRepository( new HBaseSail(conf, cmd.getOptionValue('s'), false, 0, true, 0, null)); rep.initialize(); try { Update u = rep.getConnection().prepareUpdate(QueryLanguage.SPARQL, cmd.getOptionValue('q')); LOG.info("Update execution started"); u.execute(); LOG.info("Update finished"); } finally { rep.shutDown(); } } catch (Exception exp) { System.out.println(exp.getMessage()); printHelp(options); throw exp; } }
From source file:com.sm.replica.grizzly.DefaultReplicaServer.java
public static void main(String[] args) { String[] opts = new String[] { "-store", "-path", "-port", "-mode", "index" }; String[] defaults = new String[] { "replica", "./data", "7120", "0", "0" }; String[] paras = getOpts(args, opts, defaults); String store = paras[0];// w w w . j a v a 2 s .co m int port = Integer.valueOf(paras[2]); String path = paras[1]; int mode = Integer.valueOf(paras[3]); int index = Integer.valueOf(paras[4]); CacheStore cacheStore = new CacheStore(path, null, mode); LogChannel logChannel = new LogChannel(store, index, path); DefaultReplicaServer defaultReplicaServer = new DefaultReplicaServer(logChannel, index, store, path); HashMap<String, CacheStore> storesMap = new HashMap<String, CacheStore>(); storesMap.put(store, cacheStore); UnisonFilter unisonServerFilter = new UnisonFilter(defaultReplicaServer); unisonServerFilter.setFreq(1); logger.info("start server at " + port); ReplicaServer server = new ReplicaServer(port, storesMap, unisonServerFilter); defaultReplicaServer.hookShutdown(); logger.info("set main thread to wait()"); try { //System.in.read(); Object obj = new Object(); synchronized (obj) { obj.wait(); } } catch (Exception io) { logger.error(io.getMessage(), io); } }
From source file:com.genentech.chemistry.openEye.apps.SDFMCSSSphereExclusion.java
public static void main(String... args) throws IOException { CommandLineParser parser = new PosixParser(); CommandLine cmd = null;/*from w ww . j a v a2 s. c om*/ try { cmd = parser.parse(options, args); } catch (Exception e) { System.err.println(e.getMessage()); exitWithHelp(); } args = cmd.getArgs(); if (cmd.hasOption("d")) { System.err.println("Start debugger and press return:"); new BufferedReader(new InputStreamReader(System.in)).readLine(); } // the only reason not to match centroids in reverse order id if // a non-centroid is to be assigned to multiple centroids boolean printSphereMatchCount = cmd.hasOption("printSphereMatchCount"); boolean reverseMatch = !cmd.hasOption("checkSpheresInOrder") && !printSphereMatchCount; boolean printAll = cmd.hasOption("printAll") || printSphereMatchCount; double radius = Double.parseDouble(cmd.getOptionValue("radius")); String inFile = cmd.getOptionValue("in"); String outFile = cmd.getOptionValue("out"); String refFile = cmd.getOptionValue("ref"); SimComparatorFactory<OEMolBase, OEMolBase, SimComparator<OEMolBase>> compFact; compFact = getComparatorFactory(cmd); SphereExclusion<OEMolBase, SimComparator<OEMolBase>> alg = new SphereExclusion<OEMolBase, SimComparator<OEMolBase>>( compFact, refFile, outFile, radius, reverseMatch, printSphereMatchCount, printAll); alg.run(inFile); alg.close(); }
From source file:com.kynetx.RubyRulesetParser.java
public static void main(String[] args) throws Exception { File thefile = new File(args[0]); String result_type = args[1]; try {/*w w w .ja v a 2s . c om*/ ANTLRFileStream input = new ANTLRFileStream(thefile.getCanonicalPath()); com.kynetx.RuleSetLexer lexer = new com.kynetx.RuleSetLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); com.kynetx.RuleSetParser parser = new com.kynetx.RuleSetParser(tokens); parser.ruleset(); JSONObject js = new JSONObject(parser.rule_json); if (result_type.equals("validate")) { if (parser.parse_errors.size() > 0) { for (int ii = 0; ii < parser.parse_errors.size(); ii++) { System.out.println("ERROR: " + parser.parse_errors.get(ii)); } } } else { System.out.println(js.toString()); // System.out.println(unescapeUnicode(js.toString())); } } catch (Exception e) { System.out.println("SYSTEM ERROR : " + e.getMessage()); } }
From source file:com.aestel.chemistry.openEye.fp.DistMatrix.java
public static void main(String... args) throws IOException { long start = System.currentTimeMillis(); // create command line Options object Options options = new Options(); Option opt = new Option("i", true, "input file [.tsv from FingerPrinter]"); opt.setRequired(true);/* w w w. jav a2 s . com*/ options.addOption(opt); opt = new Option("o", true, "outpur file [.tsv "); 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 (args.length != 0) exitWithHelp(options); String file = cmd.getOptionValue("i"); BufferedReader in = new BufferedReader(new FileReader(file)); file = cmd.getOptionValue("o"); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file))); ArrayList<Fingerprint> fps = new ArrayList<Fingerprint>(); ArrayList<String> ids = new ArrayList<String>(); String line; while ((line = in.readLine()) != null) { String[] parts = line.split("\t"); if (parts.length == 3) { ids.add(parts[0]); fps.add(new ByteFingerprint(parts[2])); } } in.close(); out.print("ID"); for (int i = 0; i < ids.size(); i++) { out.print('\t'); out.print(ids.get(i)); } out.println(); for (int i = 0; i < ids.size(); i++) { out.print(ids.get(i)); Fingerprint fp1 = fps.get(i); for (int j = 0; j <= i; j++) { out.printf("\t%.4g", fp1.tanimoto(fps.get(j))); } out.println(); } out.close(); System.err.printf("Done %d fingerprints in %.2gsec\n", fps.size(), (System.currentTimeMillis() - start) / 1000D); }
From source file:com.funambol.lanciadelta.LanciaDeltaShell.java
public static void main(String[] args) throws Exception { LanciaDeltaShell shell = null;// w w w . j a v a 2 s . c o m try { shell = new LanciaDeltaShell(); shell.execute(); } catch (Exception e) { System.err.println(e.getMessage()); if (System.getProperty(PROPERTY_DEBUG) != null) { e.printStackTrace(); } System.exit(1); } }