List of usage examples for java.lang Exception toString
public String toString()
From source file:com.sm.test.TestConnect.java
public static void main(String[] args) throws Exception { String[] opts = new String[] { "-host", "-port", "-times" }; String[] defaults = new String[] { "ssusd003.ir.dc", "6666", "500" }; String[] paras = getOpts(args, opts, defaults); String host = paras[0];//from w ww . j a v a2 s . c om int port = Integer.valueOf(paras[1]); int timeout = Integer.valueOf(paras[2]); // logger.info("pos="+"/test/".indexOf("/")); // logger.info("/test/".substring(0, "/test/".indexOf("/"))); // BuildClusterNodes bc = new BuildClusterNodes("./clusterStore/src/test/resources/config.xml"); // logger.info(bc.build().toString()); // BuildStoreConfig bs = new BuildStoreConfig("./clusterStore/src/test/resources/config.xml"); // logger.info(bs.build().toString()); long begin = System.currentTimeMillis(); SocketAddress inet = new InetSocketAddress(host, port); try { Socket socket = new Socket(); socket.connect(inet, timeout); socket.close(); } catch (Exception ex) { logger.error("ex " + ex.toString()); } logger.info("time in Socket ms " + (System.currentTimeMillis() - begin)); // begin = System.currentTimeMillis(); // try { // TCPClient client = TCPClient.start(host, port); // client.close(); // } catch (Exception ex) { // logger.error( ex.getMessage()); // } // logger.info("time in TCPClient ms "+(System.currentTimeMillis() - begin)); }
From source file:com.mycompany.horus.Teste.java
public static void main(String[] args) throws Exception { ServiceListener list = new ServiceListener(); list.getHorusServicesList();/*from w w w . jav a2 s . c o m*/ String soapBody = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:est=\"http://servicos.saude.gov.br/horus/v1r0/EstoqueService\">\n" + " <soap:Header>\n" + " <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd\">\n" + " <wsse:UsernameToken wsu:Id=\"Id-0001334008436683-000000002c4a1908-1\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\n" + " <wsse:Username>HORUS</wsse:Username>\n" + " <wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-token-profile-1.0#PasswordText\">SENHA</wsse:Password>\n" + " </wsse:UsernameToken>\n" + " </wsse:Security>\n" + " </soap:Header>\n" + " <soap:Body><est:requestConsultarPosicaoEstoquePorCNES>\n" + " <est:cnes>7604041</est:cnes>\n" + " </est:requestConsultarPosicaoEstoquePorCNES>\n" + " </soap:Body>\n" + "</soap:Envelope>\n"; try { // Get target URL CloseableHttpClient httpclient = HttpClientBuilder.create().build(); StringEntity strEntity = new StringEntity(soapBody, "UTF-8"); strEntity.setContentType("text/xml"); HttpPost post = new HttpPost("https://servicos.saude.gov.br/horus/v1r0/EstoqueService"); post.setEntity(strEntity); // Execute request HttpResponse response = httpclient.execute(post); HttpEntity respEntity = response.getEntity(); String resp = EntityUtils.toString(respEntity); if (respEntity != null) { System.out.println("Response:"); System.out.println(resp); //Changing response to Xml file stringToDom(resp); } else { System.out.println("No Response"); } } catch (Exception e) { System.out.println("Other exception = " + e.toString()); } }
From source file:edu.harvard.med.iccbl.screensaver.io.libraries.CreateLibraryWells.java
@SuppressWarnings("static-access") public static void main(String[] args) { final CommandLineApplication app = new CommandLineApplication(args); app.addCommandLineOption(OptionBuilder.hasArgs().isRequired().withArgName("short name") .withLongOpt("short-name").withDescription("a short name for identifying the library").create("l")); app.processOptions(true, false);/* w ww .j av a2 s . c om*/ final GenericEntityDAO dao = (GenericEntityDAO) app.getSpringBean("genericEntityDao"); dao.doInTransaction(new DAOTransaction() { @Override public void runTransaction() { try { LibraryCreator libraryCreator = (LibraryCreator) app.getSpringBean("libraryCreator"); List<String> libraryShortNames = app.getCommandLineOptionValues("l"); for (String libraryShortName : libraryShortNames) { libraryCreator.createWells( dao.findEntityByProperty(Library.class, "shortName", libraryShortName)); } } catch (Exception e) { e.printStackTrace(); log.error(e.toString()); System.err.println("error: " + e.getMessage()); System.exit(1); } } }); }
From source file:com.taveloper.http.test.PwTest.java
/** * @param args the command line arguments *//*w ww . jav a2 s .c o m*/ public static void main(String[] args) throws IOException, InterruptedException { ExecutorService es = Executors.newFixedThreadPool(1); // ? try { for (int i = 0; i < a.length; i++) { String s1 = a[i]; for (int j = 0; j < a.length; j++) { String s2 = a[j]; Pw pw = new Pw(s1 + s2); es.submit(pw); } } } catch (Exception e) { System.out.println(e.toString()); } if (es.isShutdown()) { } else { Thread.sleep(1000); } }
From source file:com.microsoft.azure.servicebus.samples.duplicatedetection.DuplicateDetection.java
public static void main(String[] args) { System.exit(runApp(args, (connectionString) -> { DuplicateDetection app = new DuplicateDetection(); try {/*from ww w . j ava2 s . co m*/ app.run(connectionString); return 0; } catch (Exception e) { System.out.printf("%s", e.toString()); return 1; } })); }
From source file:com.microsoft.azure.servicebus.samples.autoforward.AutoForward.java
public static void main(String[] args) { System.exit(runApp(args, (connectionString) -> { AutoForward app = new AutoForward(); try {//from w ww . ja v a 2s .c o m app.run(connectionString); return 0; } catch (Exception e) { System.out.printf("%s", e.toString()); return 1; } })); }
From source file:com.iiitd.qre.CreateZSignedQR.java
public static void main(String args[]) throws Exception { if (args.length != 4) System.out.println("Usage: CreateZSignedQR <signer>" + " <privkey> <xml-file> <imgout>"); else//w w w . j a v a2s.c o m try { byte[] data = XML.toJSONObject(new String(Common.readFileContents(args[2]))).toString().getBytes(); byte[] signature = Sign.sign(args[1], data); byte[] zdata = Common.gzip(data); BASE64Encoder benc64 = new BASE64Encoder(); String content = args[0] + "|" + benc64.encode(zdata) + "|" + benc64.encode(signature); System.out.println(content); QRCode qrc = new QRCode(); Encoder.encode(content, ErrorCorrectionLevel.L, qrc); writeToStream(qrc.getMatrix(), "PNG", new FileOutputStream(args[3])); } catch (Exception e) { System.err.println("Caught exception " + e.toString()); throw e; } }
From source file:com.microsoft.azure.servicebus.samples.prefetch.Prefetch.java
public static void main(String[] args) { System.exit(runApp(args, (connectionString) -> { Prefetch app = new Prefetch(); try {/*ww w . ja va2 s .c o m*/ app.run(connectionString); return 0; } catch (Exception e) { System.out.printf("%s", e.toString()); return 1; } })); }
From source file:GetProps.java
public static void main(String[] args) { /* Test reading properties w & w/out security manager */ String s;//w w w.j a v a 2 s . com try { System.out.println("About to get os.name property value"); s = System.getProperty("os.name", "not specified"); System.out.println(" The name of your operating system is: " + s); System.out.println("About to get java.version property value"); s = System.getProperty("java.version", "not specified"); System.out.println(" The version of the JVM you are running is: " + s); System.out.println("About to get user.home property value"); s = System.getProperty("user.home", "not specified"); System.out.println(" Your user home directory is: " + s); System.out.println("About to get java.home property value"); s = System.getProperty("java.home", "not specified"); System.out.println(" Your JRE installation directory is: " + s); } catch (Exception e) { System.err.println("Caught exception " + e.toString()); } }
From source file:com.microsoft.azure.servicebus.samples.jmsqueuequickstart.JmsQueueQuickstart.java
public static void main(String[] args) { System.exit(runApp(args, (connectionString) -> { JmsQueueQuickstart app = new JmsQueueQuickstart(); try {/*from ww w . j ava 2 s.co m*/ app.run(connectionString); return 0; } catch (Exception e) { System.out.printf("%s", e.toString()); return 1; } })); }