List of usage examples for java.io IOException printStackTrace
public void printStackTrace()
From source file:gov.nih.nci.caintegrator.heatmap.invokeCBS2HeatMap.java
public static void main(String[] args) { HeatMapArgs hma = new HeatMapArgs(); ReadOptions(args, hma);// w ww . java2 s . c om if ((hma.getGenomeOutFile() == null) && (hma.getGeneOutFile() == null)) { System.out.println("must specify at least one (gene or genome) output file"); System.exit(-1); } if (hma.getBigBinFile() == null) { System.out.println("must specify big bin file"); System.exit(-1); } if (hma.getSmallBinFile() == null) { System.out.println("must specify small bin file"); System.exit(-1); } if (hma.getSegmentFile() == null) { System.out.println("must specify segmented data file"); System.exit(-1); } if (hma.getRefGenesFile() == null) { System.out.println("must specify RefSeq gene flat file"); System.exit(-1); } CBSToHeatmap CBS2HM = new CBS2HeatMap(); try { CBS2HM.runCBSToHeatmap(hma); System.out.println("Completed successfully, the output file(s) are here: " + hma.getGeneOutFile() + ", " + hma.getGenomeOutFile()); } catch (IOException e) { e.printStackTrace(); } }
From source file:TextFileTest.java
public static void main(String[] args) { Employee[] staff = new Employee[3]; staff[0] = new Employee("Carl Cracker", 75000, 1987, 12, 15); staff[1] = new Employee("Harry Hacker", 50000, 1989, 10, 1); staff[2] = new Employee("Tony Tester", 40000, 1990, 3, 15); try {/*from ww w .j ava 2 s . c o m*/ // save all employee records to the file employee.dat PrintWriter out = new PrintWriter("employee.dat"); writeData(staff, out); out.close(); // retrieve all records into a new array Scanner in = new Scanner(new FileReader("employee.dat")); Employee[] newStaff = readData(in); in.close(); // print the newly read employee records for (Employee e : newStaff) System.out.println(e); } catch (IOException exception) { exception.printStackTrace(); } }
From source file:clases.Main.java
public static void main(String[] args) { try {// w w w .j a v a 2 s . c o m Manejador admin = new Manejador(); admin.setRuta("notebooks.json"); admin.Conectar(); admin.setNom_bd("notebooks"); admin.setNom_coleccion("notebooks"); DateFormat format_date = new SimpleDateFormat("yyyy-MM-dd"); Date fecha = new Date(); String date_now = format_date.format(fecha); JSONObject param_1 = new JSONObject("{id_notebook: 1}"); JSONObject busqueda = admin.Select(param_1); if (busqueda.has("id") && busqueda.get("id").equals(0)) { System.out.println(busqueda.toString(4)); } else { JSONObject[] obj_param_arr = { new JSONObject("{ notes: [{id_note: 1}] }"), new JSONObject("{ prueba: [{id_pedo: 1}] }") }; JSONObject nota = admin.SelectIntoArray(busqueda, obj_param_arr[0]); String claves = "\"HESOYAM\\nLXGIWYL\""; String str_js = "{ notes: [{titulo: Claves GTA San andreas PC, note: " + claves + ", fecha_modificacion: " + date_now + "}] }"; String str_js2 = "{ prueba: [{texto: HOla}] }"; String str_js3 = "{ notes: [{note: \"No c, weno si c pero no te wa decir\"}] }"; String[] arr_changes = { str_js, str_js2, str_js3 }; /*JSONObject cambios = new JSONObject(arr_changes[2]); boolean exito = admin.updateIntoArray(nota, cambios); if(exito) { System.out.println("Registro editado de manera satisfactoria!"); } else { System.out.println("Registro no encontrado"); }*/ String[] targets = { "{ notes: [{id_note: 1}] }" }; //admin.delete(param_1); JSONObject target = new JSONObject(targets[0]); admin.deleteIntoArray(busqueda, target); } /* JSONObject cambio = new JSONObject("{nombre: Cronicas Rata, fecha_modificacion: \""+ date_now +"\"}"); boolean exito = admin.update(new JSONObject("{id_notebook: 2}"), cambio); if(exito) { System.out.println("Registro modificado de manera satisfactoria"); }*/ } catch (FileNotFoundException fe) { fe.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (JSONException je) { je.printStackTrace(); } }
From source file:com.github.sakserv.lslock.cli.LockListerCli.java
/** * Main driver// w w w .j a va 2s .c om * @param args Command line args */ public static void main(String[] args) { LOG.debug("Starting the LockLister"); // Run compat checks if (!CompatUtils.runCompatChecks()) { LOG.error("Compat checks failed. Linux is required."); System.exit(1); } // Parse the command line args LockListerCliParser lockListerCliParser = new LockListerCliParser(args); // List the locks try { // Load /proc/locks // The hashmap provides the contents of /proc/locks // as <inode, pid> HashMap<Integer, Integer> procLocksContents = parseProcLocks(); // List the locks printLocks(lockListerCliParser.getLockDirectory(), procLocksContents); } catch (IOException e) { e.printStackTrace(); } LOG.debug("LockLister finished"); }
From source file:de.hbz.lobid.helper.CompareJsonMaps.java
public static void main(String... args) { if (args.length < 2) CompareJsonMaps.logger//from w w w . j a v a 2 s . c o m .info("Usage: <filename1> <filename2> {<false> if @context should be taken into acount}"); filename1 = args[0]; filename2 = args[1]; CompareJsonMaps.logger.info("\n" + filename1 + " may be referenced in the logs as 'actual'\n" + filename2 + " may be referenced as 'expected'"); if (args.length >= 3 && args[2].equals("false")) IGNORE_CONTEXT = false; try { if (new CompareJsonMaps().writeFileAndTestJson( new ObjectMapper().readValue(new File(args[0]), JsonNode.class), new ObjectMapper().readValue(new File(args[1]), JsonNode.class))) CompareJsonMaps.logger.info("OK. The content is equal."); else CompareJsonMaps.logger.info("Sadeness. The content differs."); } catch (IOException e) { e.printStackTrace(); } }
From source file:mitm.common.sms.transport.clickatell.ClickatellServerSimulator.java
public static void main(String[] args) { try {//from ww w .j a va 2 s. c om startServer(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.linkedin.pinotdruidbenchmark.PinotThroughput.java
@SuppressWarnings("InfiniteLoopStatement") public static void main(String[] args) throws Exception { if (args.length != 3 && args.length != 4) { System.err.println(//from w w w. j a va 2s . c om "3 or 4 arguments required: QUERY_DIR, RESOURCE_URL, NUM_CLIENTS, TEST_TIME (seconds)."); return; } File queryDir = new File(args[0]); String resourceUrl = args[1]; final int numClients = Integer.parseInt(args[2]); final long endTime; if (args.length == 3) { endTime = Long.MAX_VALUE; } else { endTime = System.currentTimeMillis() + Integer.parseInt(args[3]) * MILLIS_PER_SECOND; } File[] queryFiles = queryDir.listFiles(); assert queryFiles != null; Arrays.sort(queryFiles); final int numQueries = queryFiles.length; final HttpPost[] httpPosts = new HttpPost[numQueries]; for (int i = 0; i < numQueries; i++) { HttpPost httpPost = new HttpPost(resourceUrl); String query = new BufferedReader(new FileReader(queryFiles[i])).readLine(); httpPost.setEntity(new StringEntity("{\"pql\":\"" + query + "\"}")); httpPosts[i] = httpPost; } final AtomicInteger counter = new AtomicInteger(0); final AtomicLong totalResponseTime = new AtomicLong(0L); final ExecutorService executorService = Executors.newFixedThreadPool(numClients); for (int i = 0; i < numClients; i++) { executorService.submit(new Runnable() { @Override public void run() { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { while (System.currentTimeMillis() < endTime) { long startTime = System.currentTimeMillis(); CloseableHttpResponse httpResponse = httpClient .execute(httpPosts[RANDOM.nextInt(numQueries)]); httpResponse.close(); long responseTime = System.currentTimeMillis() - startTime; counter.getAndIncrement(); totalResponseTime.getAndAdd(responseTime); } } catch (IOException e) { e.printStackTrace(); } } }); } executorService.shutdown(); long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() < endTime) { Thread.sleep(REPORT_INTERVAL_MILLIS); double timePassedSeconds = ((double) (System.currentTimeMillis() - startTime)) / MILLIS_PER_SECOND; int count = counter.get(); double avgResponseTime = ((double) totalResponseTime.get()) / count; System.out.println("Time Passed: " + timePassedSeconds + "s, Query Executed: " + count + ", QPS: " + count / timePassedSeconds + ", Avg Response Time: " + avgResponseTime + "ms"); } }
From source file:com.camel.crawler.WebCrawler.java
public static void main(String[] args) { WebCrawler crawler = new WebCrawler(); boolean finished = true; while (finished) { try {// www .j ava2s. co m pageInit++; System.out.println("url num:=" + pageInit); try { crawler.fetchWeb(URL_PRE + String.valueOf(pageInit) + "/"); } catch (IOException e) { pageInit--; e.printStackTrace(); //?1? try { System.out.println("exception sleep 1 min"); Thread.sleep(60000); } catch (InterruptedException e1) { e1.printStackTrace(); } } //????crawler if (pageInit == pageEnd) { finished = false; } try { Thread.sleep(700); } catch (InterruptedException e) { e.printStackTrace(); } } catch (Exception e) { System.out.println("unknow exception"); e.printStackTrace(); } } }
From source file:contractEditor.contractHOST4.java
public static void main(String[] args) { JSONObject obj = new JSONObject(); obj.put("name", "HOST4"); obj.put("context", "VM-deployment"); //obj.put("Context", new Integer); HashMap serviceDescription = new HashMap(); serviceDescription.put("location", "France"); serviceDescription.put("certificate", "true"); serviceDescription.put("volume", "100_GB"); serviceDescription.put("price", "3_euro"); obj.put("serviceDescription", serviceDescription); HashMap gauranteeTerm = new HashMap(); gauranteeTerm.put("availability", "more_98_percentage"); obj.put("gauranteeTerm", gauranteeTerm); //Constraint1 ArrayList creationConstraint1 = new ArrayList(); ArrayList totalConstraint = new ArrayList(); totalConstraint.add(creationConstraint1); obj.put("creationConstraint", totalConstraint); try {//from w ww. j a v a 2s . com FileWriter file = new FileWriter("confSP" + File.separator + "Host4.json"); file.write(obj.toJSONString()); file.flush(); file.close(); } catch (IOException e) { e.printStackTrace(); } System.out.print(obj); /* JSONParser parser = new JSONParser(); try { Object obj2 = parser.parse(new FileReader("confSP\\confHost1.json")); JSONObject jsonObject = (JSONObject) obj2; HashMap serviceDescription2=(HashMap) jsonObject.get("serviceDescription"); method.printHashMap(serviceDescription2); HashMap gauranteeTerm2=(HashMap) jsonObject.get("gauranteeTerm"); method.printHashMap(gauranteeTerm2); ArrayList creationConstraint=(ArrayList) jsonObject.get("creationConstraint"); method.printArrayList(creationConstraint); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } */ }
From source file:edu.harvard.i2b2.loinc.BinResourceFromLoincData.java
public static void main(String[] args) { try {//w w w .j av a2s . c om new BinResourceFromLoincData("/Users/kbw19/Downloads/LOINC_252_Text/"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }