List of usage examples for java.lang Throwable getMessage
public String getMessage()
From source file:com.hp.mqm.atrf.Main.java
private static void setUncaughtExceptionHandler() { Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { logger.error(e.getMessage(), e); }/*from w w w.java2 s. co m*/ }); }
From source file:gridool.GridMain.java
private static void shutdown(final GridServer grid, final Throwable e) { String errmsg = "Failed to start grid: " + e.getMessage(); LogFactory.getLog(GridMain.class).error(errmsg, e); System.err.println(errmsg);/*from ww w. j av a 2 s . com*/ try { grid.shutdown(true); } catch (RemoteException re) { ; } }
From source file:Main.java
public static String getStackTraceAsString(Throwable e) { String stackTraceString = e.getClass().getName() + ": " + e.getMessage(); for (StackTraceElement ste : e.getStackTrace()) { stackTraceString += "\n" + ste.toString(); }//from ww w. j av a 2s. c o m return stackTraceString; }
From source file:Main.java
public static void showException(Activity activity, String msg, Throwable e) { e.printStackTrace();/* ww w . j ava 2 s . c om*/ String s = String.format("%s: %s", msg, e.getMessage()); showToast(activity, s); Log.e(TAG, s); }
From source file:Main.java
/** * From the given throwable or its cause, or cause's cause, etc., * get the first one that has a non-empty message, and return that message. * * @param t//from w ww .j a va2 s .co m * @return the first non-empty message string, or null. */ public static String getFirstMeaningfulMessage(Throwable t) { if (t == null) return null; String m = t.getMessage(); if (m != null && !m.isEmpty()) { return m; } return getFirstMeaningfulMessage(t.getCause()); }
From source file:Main.java
public static void processInstantiationExceptions(Throwable e, Class clazz) throws IllegalAccessException { throw new IllegalAccessException(e.getMessage() + " class name:" + ((clazz != null) ? clazz.getName() : "") + " maybe you use this class as inner " + "class, so we cant instantiate that outer from that, or maybe private modifier exist"); }
From source file:org.seedstack.spring.batch.fixtures.FlatFileBatchDemo.java
protected static void printStatistics(JobExecution jobExecution) { for (StepExecution stepExecution : jobExecution.getStepExecutions()) { System.out.println("-----------------------------------"); System.out.println("STEP name: " + stepExecution.getStepName()); System.out.println("-----------------------------------"); System.out.println("CommitCount: " + stepExecution.getCommitCount()); System.out.println("FilterCount: " + stepExecution.getFilterCount()); System.out.println("ProcessSkipCount: " + stepExecution.getProcessSkipCount()); System.out.println("ReadCount: " + stepExecution.getReadCount()); System.out.println("ReadSkipCount: " + stepExecution.getReadSkipCount()); System.out.println("RollbackCount: " + stepExecution.getRollbackCount()); System.out.println("SkipCount: " + stepExecution.getSkipCount()); System.out.println("WriteCount: " + stepExecution.getWriteCount()); System.out.println("WriteSkipCount: " + stepExecution.getWriteSkipCount()); if (stepExecution.getFailureExceptions().size() > 0) { System.out.println("exceptions:"); System.out.println("-----------------------------------"); for (Throwable t : stepExecution.getFailureExceptions()) { System.out.println(t.getMessage()); }/*from ww w. ja va 2 s. c o m*/ } System.out.println("-----------------------------------"); } }
From source file:com.scsy150.util.CharsetUtils.java
public static String toCharset(final String str, final String charset, int judgeCharsetLength) { try {/*from ww w . ja v a2s . c o m*/ String oldCharset = getEncoding(str, judgeCharsetLength); return new String(str.getBytes(oldCharset), charset); } catch (Throwable ex) { LogUtil.w("", ex.getMessage()); return str; } }
From source file:www.ht.com.app.tools.CharsetUtils.java
public static String toCharset(final String str, final String charset, int judgeCharsetLength) { try {//from w ww.j a va2 s . co m String oldCharset = getEncoding(str, judgeCharsetLength); return new String(str.getBytes(oldCharset), charset); } catch (Throwable ex) { Logger.w(ex.getMessage()); return str; } }
From source file:com.clustercontrol.plugin.ClassUtils.java
/** * ??URLCLASSPATH??<br/>//from w w w . j ava2 s.c o m * @param ?URL * @throws IOException */ public static void addURL(URL u) throws IOException { URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); for (URL url : sysLoader.getURLs()) { if (url.toString().equals(u.toString())) { log.info("URL " + u + " is already in CLASSPATH"); return; } } Class<URLClassLoader> sysClass = URLClassLoader.class; try { Method method = sysClass.getDeclaredMethod("addURL", new Class[] { URL.class }); method.setAccessible(true); method.invoke(sysLoader, new Object[] { u }); } catch (Throwable t) { log.warn(t.getMessage(), t); throw new IOException("could not add URL " + u + " to CLASSPATH"); } }