List of usage examples for java.lang Throwable printStackTrace
public void printStackTrace()
From source file:com.aw.support.reflection.MethodInvoker.java
/** * Invoke specific method on the target and returns the value that this method returns * * @param target//from w ww . j av a2 s. co m * @return */ public static Object invokeMethodWithPrefix(Object target, String prefix) throws Throwable { List results = new ArrayList(); try { Class cls = target.getClass(); Method[] methods = cls.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().startsWith(prefix)) { results.add(methods[i].invoke(target, null)); } } } catch (Throwable e) { e.printStackTrace(); throw e; } return results; }
From source file:com.heliosdecompiler.bootstrapper.Bootstrapper.java
static void displayError(Throwable t) { t.printStackTrace(); StringWriter writer = new StringWriter(); t.printStackTrace(new PrintWriter(writer)); JOptionPane.showMessageDialog(null, writer.toString(), t.getClass().getSimpleName(), JOptionPane.INFORMATION_MESSAGE); }
From source file:edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils.java
public static String getReqInfo(HttpServletRequest req) { String rv = null;/*from w w w.j a va2 s . co m*/ try { rv = "<table>" + "<tr><td><h2>Request Attributes:</h2></td></tr>" + "<tr><td>" + getRequestAttributes(req) + "</td></tr>" + "<tr><td>--------------------------</td></tr>" + "<tr><td><h2>Request Parameters:</h2></td></tr>" + "<tr><td>" + getRequestParam(req) + "</td></tr>" + "<tr><td>---------------------------</td></td>" + "<tr><td><h2>Session Attributes:</h2></td></tr>" + "<tr><td>" + getSessionAttributes(req) + "</td></tr>" + "</table>"; } catch (Throwable t) { rv = "MiscWebUtils.getRequestParam() Error :\n" + t; t.printStackTrace(); } return rv; }
From source file:com.ah.util.Tracer.java
private static void log(Object msg, Throwable t) { String curTime = AhDateTimeUtil.getCurrentDateTime(); System.out.println(curTime + " # " + msg); t.printStackTrace(); }
From source file:it.unibz.instasearch.InstaSearchPlugin.java
public static void debug(Throwable t) { if (!isDebug()) return;//from www . j a va 2 s .com t.printStackTrace(); }
From source file:gov.nih.nci.ncicb.cadsr.bulkloader.util.excel.ExcelUtility.java
public static Date getDate(HSSFSheet sheet, int row, short col) { HSSFRow hssfRow = getRow(sheet, row); if (hssfRow == null) { return null; }/*ww w . jav a 2 s . co m*/ HSSFCell cell = getRow(sheet, row).getCell(col); if (isNull(cell)) { return null; } try { return cell.getDateCellValue(); } catch (Throwable t) { t.printStackTrace(); log.error("Unable to read date from " + row + "," + col, t); return null; } }
From source file:Main.java
private static DateTime getDateFromISO(String ISOString) { //DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); DateTimeFormatter parser = ISODateTimeFormat.dateTimeNoMillis().withZoneUTC(); try {//from w ww . j a v a2 s . co m return parser.parseDateTime(ISOString); } catch (Throwable e) { try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); df.setTimeZone(TimeZone.getTimeZone("UTC")); return new DateTime(df.parse(ISOString)); } catch (Throwable ignored) { Log.d("ERROR", "Failed parsing string into date"); e.printStackTrace(); } } return null; }
From source file:com.taobao.itest.util.XlsUtil.java
/** * To read Excel data into a Map structure * /*from w w w. ja v a 2s . c om*/ * @param excelDir * excel file path, such as: abc.xls this file exists called to * the same level directory * * @return converted Map */ public static Map<String, List<Map<String, Object>>> readData(String execlDir) { Map<String, List<Map<String, Object>>> allData = new HashMap<String, List<Map<String, Object>>>(); List<Map<String, Object>> sheet = null; String excelRealPath = getExcelRealPath(execlDir); IDataSet dataSet; try { dataSet = new XlsDataSet(ResourceUtils.getFile(excelRealPath)); // traverse all sheet String[] allDataTable = dataSet.getTableNames(); ITable dataTable = null; ITableMetaData meta = null; Column[] columns = null; Map<String, Object> row = null; String columnName = null; Object obj = null; // read every Sheet for (int d = 0; d < allDataTable.length; d++) { dataTable = dataSet.getTable(allDataTable[d]); meta = dataTable.getTableMetaData(); columns = meta.getColumns(); sheet = new ArrayList<Map<String, Object>>(); // read every line for (int k = 0; k < dataTable.getRowCount(); k++) { row = Collections.synchronizedMap(new CamelCasingHashMap<String, Object>()); ; for (int i = 0; i < columns.length; i++) { columnName = columns[i].getColumnName(); obj = dataTable.getValue(k, columnName); row.put(columnName, obj); } sheet.add(k, row); } allData.put(allDataTable[d], sheet); } } catch (Throwable e) { e.printStackTrace(); } return allData; }
From source file:de.fau.cs.osr.hddiff.perfsuite.TaskProcessor.java
private static void reportException(Throwable e) { System.out.println();// w w w. ja v a 2 s. co m System.out.flush(); e.printStackTrace(); System.err.flush(); }
From source file:com.bangalore.barcamp.BCBUtils.java
public static void updateContextDataFromSharedPreferences(Context context) { try {/*w w w .java 2s .co m*/ String page = BCBSharedPrefUtils.getAllBCBUpdates(context, null); if (page != null) { BarcampData data; data = DataProcessingUtils.parseBCBJSON(page); ((BarcampBangalore) context).setBarcampData(data); } } catch (Throwable e) { e.printStackTrace(); } }