List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:edu.toronto.cs.phenotips.obo2solr.Main.java
public static void main(String[] args) { Options options = generateOptions(); try {//from w ww. j av a 2 s .c o m CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); if (!cmd.hasOption(OBO_DB_LOCATION_OPTION) || cmd.hasOption(HELP_OPTION)) { showUsage(options); System.exit(cmd.hasOption(HELP_OPTION) ? 0 : 1); } ParameterPreparer paramPrep = new ParameterPreparer(); SolrUpdateGenerator generator = new SolrUpdateGenerator(); File input = paramPrep.getInputFileHandler(cmd.getOptionValue(OBO_DB_LOCATION_OPTION)); File output = paramPrep.getOutputFileHandler( cmd.getOptionValue(OUTPUT_XML_LOCATION_OPTION, DEFAULT_OUTPUT_XML_LOCATION)); Map<String, Double> fieldSelection = paramPrep .getFieldSelection(cmd.getOptionValue(INDEX_FILEDS_OPTION, "")); generator.transform(input, output, fieldSelection); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:gov.va.vinci.leo.integration.IntegrationClient.java
public static void main(String[] args) { try {/*from ww w . j ava 2s. c om*/ new IntegrationClient().run(Services.HEART_SERVICE); } catch (Exception e) { e.printStackTrace(); } }
From source file:TestConnectToMoreThanOneDatabase.java
public static void main(String[] args) { Connection oracleConn = null; Connection mysqlConn = null;/*from w ww.jav a2 s . c om*/ try { oracleConn = getOracleConnection(); mysqlConn = getMySqlConnection(); System.out.println("oracleConn=" + oracleConn); System.out.println("mysqlConn=" + mysqlConn); } catch (Exception e) { // handle the exception e.printStackTrace(); System.exit(1); } finally { // release database resources try { oracleConn.close(); mysqlConn.close(); } catch (SQLException e) { e.printStackTrace(); } } }
From source file:SearchWithFilterRetAll.java
public static void main(String[] args) { // Set up the environment for creating the initial context Hashtable<String, Object> env = new Hashtable<String, Object>(11); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial"); try {/*from w w w.j a v a 2 s . co m*/ // Create initial context DirContext ctx = new InitialDirContext(env); // Create default search controls SearchControls ctls = new SearchControls(); // Specify the search filter to match // Ask for objects with attribute sn == Geisel and which have // the "mail" attribute. String filter = "(&(sn=Geisel)(mail=*))"; // Search for objects using filter NamingEnumeration answer = ctx.search("ou=People", filter, ctls); // Print the answer // Search.printSearchEnumeration(answer); // Close the context when we're done ctx.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:JAXPTransletMultipleTransformations.java
public static void main(String argv[]) { // Set the TransformerFactory system property to generate and use translets. // Note: To make this sample more flexible, load properties from a properties file. // The setting for the Xalan Transformer is "org.apache.xalan.processor.TransformerFactoryImpl" String key = "javax.xml.transform.TransformerFactory"; String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; Properties props = System.getProperties(); props.put(key, value);//from www. j a va 2 s .co m System.setProperties(props); String xslInURI = "todo.xsl"; try { // Instantiate the TransformerFactory, and use it along with a SteamSource // XSL stylesheet to create a translet as a Templates object. TransformerFactory tFactory = TransformerFactory.newInstance(); Templates translet = tFactory.newTemplates(new StreamSource(xslInURI)); // Perform each transformation doTransform(translet, "todo.xml", "todo.html"); System.out.println("Produced todo.html"); doTransform(translet, "todotoo.xml", "todotoo.html"); System.out.println("Produced todotoo.html"); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.tragicphantom.stdf.tools.extract.CommandLine.java
public static void main(String[] args) { try {/*from ww w.j av a2 s . co m*/ Options options = setupOptions(); org.apache.commons.cli.CommandLine cl = new GnuParser().parse(options, args); if (cl.hasOption("t")) { HashSet<String> types = new HashSet<String>(Arrays.asList(cl.getOptionValue("t").split(","))); OutputFormatter outputFormatter; if (cl.hasOption("x")) outputFormatter = new RawOutputFormatter(); else if (cl.hasOption("c")) outputFormatter = new CsvOutputFormatter(); else outputFormatter = new DefaultOutputFormatter(); for (String file : cl.getArgs()) { System.out.println(file); Visitor visitor = new Visitor(file, types); System.out.println(visitor.size() + " records found"); for (Record record : visitor) outputFormatter.write(record); } } else new HelpFormatter().printHelp("extract", options); } catch (Exception e) { e.printStackTrace(); } }
From source file:DOMGenerate.java
public static void main(String[] argv) { try {/* ww w .j a va2 s. c om*/ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Element root = doc.createElementNS(null, "person"); // Create Root Element Element item = doc.createElementNS(null, "name"); // Create element item.appendChild(doc.createTextNode("Jeff")); root.appendChild(item); // Attach element to Root element item = doc.createElementNS(null, "age"); // Create another Element item.appendChild(doc.createTextNode("28")); root.appendChild(item); // Attach Element to previous element down tree item = doc.createElementNS(null, "height"); item.appendChild(doc.createTextNode("1.80")); root.appendChild(item); // Attach another Element - grandaugther doc.appendChild(root); // Add Root to Document DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS domImplLS = (DOMImplementationLS) registry.getDOMImplementation("LS"); LSSerializer ser = domImplLS.createLSSerializer(); // Create a serializer // for the DOM LSOutput out = domImplLS.createLSOutput(); StringWriter stringOut = new StringWriter(); // Writer will be a String out.setCharacterStream(stringOut); ser.write(doc, out); // Serialize the DOM System.out.println("STRXML = " + stringOut.toString()); // Spit out the // DOM as a String } catch (Exception ex) { ex.printStackTrace(); } }
From source file:com.google.flightmap.parsing.faa.nasr.tools.RecordClassMaker.java
public static void main(String[] args) { try {//w ww . jav a2 s . com final BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final String name = in.readLine(); final List<RecordEntry> entries = new LinkedList<RecordEntry>(); String line; while ((line = in.readLine()) != null) { final String[] parts = line.split("\\s+"); final int length = Integer.parseInt(parts[0]); final int start = Integer.parseInt(parts[1]); final String entryName = parts[2]; entries.add(new RecordEntry(length, start, entryName)); } (new RecordClassMaker(name, entries)).execute(); } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } }
From source file:com.googlecode.erca.framework.io.in.CsvContextParser.java
public static void main(String[] args) { try {/*from w w w . j av a 2s.c o m*/ CsvContextParser parser = new CsvContextParser("doc/samples/csv/simpletest.csv"); parser.parse(); } catch (Exception e) { e.printStackTrace(); } }
From source file:EarlyReturn.java
public static void main(String[] args) { try {//from w w w . ja va 2s . c o m final EarlyReturn er = new EarlyReturn(0); Runnable r = new Runnable() { public void run() { try { Thread.sleep(1500); er.setValue(2); Thread.sleep(500); er.setValue(3); Thread.sleep(500); er.setValue(4); } catch (Exception x) { x.printStackTrace(); } } }; Thread t = new Thread(r); t.start(); System.out.println("waitUntilAtLeast(5, 3000)"); long startTime = System.currentTimeMillis(); boolean retVal = er.waitUntilAtLeast(5, 3000); long elapsedTime = System.currentTimeMillis() - startTime; System.out.println(elapsedTime + " ms, retVal=" + retVal); } catch (InterruptedException ix) { ix.printStackTrace(); } }