List of usage examples for java.lang Throwable getMessage
public String getMessage()
From source file:com.cisco.dvbu.ps.common.util.CompositeLogger.java
/** * get the log information about the passed in soap fault * //from www . ja va 2s.co m * @param e exception to be logged (ignore if null) * @param SoapFault Fault Object contains additional information about the issue to help the developer in diagnosing the problem * @return Message String */ public static String getFaultException(Throwable ex, Fault f) { String logMessage = ""; if (f.getErrorEntry() != null) { for (MessageEntry entry : f.getErrorEntry()) { logMessage = logMessage + ex.getMessage() + " (detail) " + entry.getName() + ":" + entry.getCode() + ":" + entry.getClass() + ":" + entry.getMessage() + ":\n" + entry.getDetail() + "\n"; } } return logMessage; }
From source file:com.cisco.dvbu.ps.common.util.CompositeLogger.java
/** * get the log information about the passed in soap fault * /* ww w .j a va 2 s. co m*/ * @param e exception to be logged (ignore if null) * @param SoapFault Fault Object contains additional information about the issue to help the developer in diagnosing the problem * @return Message String */ public static String getFaultMessage(Throwable ex, Fault f) { String logMessage = ""; if (f.getErrorEntry() != null) { for (MessageEntry entry : f.getErrorEntry()) { logMessage = logMessage + ex.getMessage() + " (detail) " + entry.getName() + ":" + entry.getCode() + ":" + entry.getMessage(); } } return logMessage; }
From source file:com.metadave.kash.KashConsole.java
private static void processOutput(KashRuntimeContext runtimeCtx, PrintWriter out, boolean ansi) { List<Throwable> errors = runtimeCtx.getErrors(); for (Throwable t : errors) { ANSIBuffer buf = new ANSIBuffer(); buf.setAnsiEnabled(ansi);//from ww w . j a v a2s . c o m buf.red(t.getMessage()); if (t.getCause() != null) { buf.red(":" + t.getCause().getMessage()); } buf.append("\n"); System.out.print(buf.toString()); } // TODO //runtimeCtx.reset(); }
From source file:de.tbuchloh.kiskis.KisKis.java
private static void initThreadMonitors() { final UncaughtExceptionHandler eh = new UncaughtExceptionHandler() { @Override//from w ww . jav a2 s .c o m public void uncaughtException(Thread t, Throwable e) { LOG.debug("Uncaught Exception occurred! e=" + e.getMessage()); try { MessageBox.showException(e); } catch (final Throwable throwable) { LOG.error( "Uncaught Exception could not be displayed due to another exception! anotherThrowable=" + throwable + ", rootCause=" + e, throwable); } } }; Thread.setDefaultUncaughtExceptionHandler(eh); final ThreadDeadlockDetector detector = new ThreadDeadlockDetector(); detector.addListener(new DefaultDeadlockListener()); detector.addListener(new DefaultDeadlockListener() { private volatile boolean fired = false; @Override public void deadlockDetected(Thread[] deadlockedThreads) { if (fired) { return; } fired = true; final File file = new File(System.getProperty("java.io.tmpdir"), "kiskis-deadlock.txt"); final String msg = format( "Threads were blocked!\nYou need to restart the application.\nPlease mail file \"%2$s\" as bug.\nthreads=%1$s", Arrays.toString(deadlockedThreads), file.getAbsolutePath()); JOptionPane.showMessageDialog(null, msg, "Deadlock detected!", JOptionPane.ERROR_MESSAGE); } }); }
From source file:com.metadave.eql.EQLConsole.java
private static void processOutput(RuntimeContext runtimeCtx, PrintWriter out, boolean ansi) { List<Throwable> errors = runtimeCtx.getErrors(); for (Throwable t : errors) { ANSIBuffer buf = new ANSIBuffer(); buf.setAnsiEnabled(ansi);//ww w.j a v a2 s . c o m buf.red(t.getMessage()); if (t.getCause() != null) { buf.red(":" + t.getCause().getMessage()); } buf.append("\n"); System.out.print(buf.toString()); } // TODO //runtimeCtx.reset(); }
From source file:eu.ensure.aging.AgingSimulator.java
private static void simulateAging(String name, InputStream is, OutputStream os, Properties properties) { Logger log = LoggingUtils.setupLoggingFor(AgingSimulator.class, "log-configuration.xml"); try {//from ww w . ja v a 2 s . c om ProcessorManager manager = null; InputStream config = null; try { config = AgingSimulator.class.getResourceAsStream("aging-configuration.xml"); manager = new ProcessorManager(properties, config); manager.prepare(); } catch (ProcessorException pe) { Throwable cause = Stacktrace.getBaseCause(pe); String info = "Failed to initiate processor manager: " + cause.getMessage(); info += "\n" + Stacktrace.asString(cause); log.warn(info); } finally { try { if (null != config) config.close(); } catch (Throwable ignore) { } } BasicProcessorContext context = new BasicProcessorContext(name); manager.apply(name, is, os, context); } catch (ProcessorException pe) { Throwable cause = Stacktrace.getBaseCause(pe); String info = "Failed to simulate aging on AIP: " + cause.getMessage(); System.err.println(info + "\n" + Stacktrace.asString(cause)); } catch (IOException ioe) { String info = "Failed: " + ioe.getMessage(); System.err.println(info); } }
From source file:ch.entwine.weblounge.common.impl.util.TemplateUtils.java
/** * Loads the resource identified by concatenating the package name from * <code>clazz</code> and <code>path</code> from the classpath. * /*w w w. j a v a 2s . c o m*/ * @param path * the path relative to the package name of <code>clazz</code> * @param clazz * the class * @param language * the requested language * @param site * the associated site * @return the resource */ public static String load(String path, Class<?> clazz, Language language, Site site) { if (path == null) throw new IllegalArgumentException("path cannot be null"); if (clazz == null) throw new IllegalArgumentException("clazz cannot be null"); String pkg = null; if (!path.startsWith("/")) pkg = "/" + clazz.getPackage().getName().replace('.', '/'); // Try to find the template in any of the usual languages InputStream is = null; String[] templates = null; if (site != null) templates = LanguageUtils.getLanguageVariants(path, language, site.getDefaultLanguage()); else templates = LanguageUtils.getLanguageVariants(path, language); for (String template : templates) { String pathToTemplate = pkg != null ? UrlUtils.concat(pkg, template) : template; is = clazz.getResourceAsStream(pathToTemplate); if (is != null) { path = template; break; } } // If is is still null, then the template doesn't exist. if (is == null) { logger.error("Template " + path + " not found in any language"); return null; } // Load the template InputStreamReader isr = null; StringBuffer buf = new StringBuffer(); try { logger.debug("Loading " + path); isr = new InputStreamReader(is, Charset.forName("UTF-8")); char[] chars = new char[1024]; int count = 0; while ((count = isr.read(chars)) > 0) { for (int i = 0; i < count; i++) buf.append(chars[i]); } return buf.toString(); } catch (Throwable t) { logger.warn("Error reading " + path + ": " + t.getMessage()); } finally { IOUtils.closeQuietly(isr); IOUtils.closeQuietly(is); } logger.debug("Template " + path + " loaded"); return null; }
From source file:com.google.dart.tools.ui.internal.refactoring.ServiceUtils_NEW.java
/** * @return the error {@link IStatus} for the given {@link Throwable}. *//*from w w w . jav a 2 s .c o m*/ private static IStatus createRuntimeStatus(Throwable e) { return new Status(IStatus.ERROR, DartToolsPlugin.getPluginId(), e.getMessage(), e); }
From source file:com.jilk.ros.rosbridge.implementation.JSON.java
private static JSONObject convertStringToJSONObject(String json) { JSONObject result = null;//from w ww . j av a2 s . co m StringReader r = new StringReader(json); JSONParser jp = new JSONParser(); try { result = (JSONObject) jp.parse(r); } catch (Throwable t) { System.out.println(t.getMessage()); } r.close(); return result; }
From source file:com.basho.contact.ContactConsole.java
private static void processOutput(RuntimeContext runtimeCtx, PrintWriter out, boolean ansi) { List<Throwable> errors = runtimeCtx.getErrors(); for (Throwable t : errors) { ANSIBuffer buf = new ANSIBuffer(); buf.setAnsiEnabled(ansi);// w w w . j av a2 s . c om buf.red(t.getMessage()); if (t.getCause() != null) { buf.red(":" + t.getCause().getMessage()); } buf.append("\n"); System.out.print(buf.toString()); } runtimeCtx.reset(); }