List of usage examples for java.lang Throwable getLocalizedMessage
public String getLocalizedMessage()
From source file:org.opencms.ui.components.CmsErrorDialog.java
/** * Shows the error dialog.<p>/*from w w w .j av a 2s .c o m*/ * * @param t the error to be displayed * @param onClose executed on close */ public static void showErrorDialog(Throwable t, Runnable onClose) { showErrorDialog(t.getLocalizedMessage(), t, onClose); }
From source file:pl.filippop1.antibot.Configuration.java
public static void exception(Throwable exception) { Bukkit.getLogger().log(Level.WARNING, "Konfiguracja nie jest prawidlowa ({0}): {1}.", new Object[] { exception.toString(), exception.getLocalizedMessage() }); }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.security.mca.internal.Utils.java
/** * Extracts a JSON object from server response with secured string. * * @param response Server response/*from w ww . java2s . c om*/ * @return Extracted secured JSON or null. */ public static JSONObject extractSecureJson(Response response) { try { String responseText = response.getResponseText(); if (!responseText.startsWith(SECURE_PATTERN_START) || !responseText.endsWith(SECURE_PATTERN_END)) { return null; } int startIndex = responseText.indexOf(SECURE_PATTERN_START); int endIndex = responseText.indexOf(SECURE_PATTERN_END, responseText.length() - SECURE_PATTERN_END.length() - 1); String jsonString = responseText.substring(startIndex + SECURE_PATTERN_START.length(), endIndex); return new JSONObject(jsonString); } catch (Throwable t) { logger.error("extractSecureJson failed with exception: " + t.getLocalizedMessage(), t); return null; } }
From source file:com.runwaysdk.logging.RunwayLogUtil.java
public static String getExceptionLoggableMessage(Throwable e) { return formatLoggableMessage(e.getMessage(), e.getLocalizedMessage()); }
From source file:org.openlegacy.ide.eclipse.util.PopupUtil.java
public static void exception(final Throwable ex) { exception(ex.getLocalizedMessage(), ex); }
From source file:org.apache.lens.server.api.util.LensUtil.java
/** * Get the message corresponding to base cause. If no cause is available or no message is available * parent's message is returned.// w ww .java 2 s . co m * * @param e * @return message */ public static String getCauseMessage(@NonNull Throwable e) { String expMsg = null; if (e.getCause() != null) { expMsg = getCauseMessage(e.getCause()); } if (StringUtils.isBlank(expMsg)) { expMsg = e.getLocalizedMessage(); } return expMsg; }
From source file:com.comcast.viper.flume2storm.F2SConfigurationException.java
protected static final String buildErrorMessage(String parameter, Object value, Throwable throwable) { return new StringBuilder("Configuration attribute \"").append(parameter).append("\" has invalid value (\"") .append(value).append("\"). ").append(throwable.getClass().getSimpleName()).append(": ") .append(throwable.getLocalizedMessage()).toString(); }
From source file:adalid.commons.util.ThrowableUtils.java
public static String getString(Throwable throwable) { if (throwable == null) { return Throwable.class.getName(); }//from w ww . j a v a 2s.c om String string; Throwable cause = throwable.getCause(); if (cause != null) { return getString(cause); } string = throwable.getLocalizedMessage(); if (StringUtils.isNotBlank(string)) { return getString(string); } string = throwable.getMessage(); if (StringUtils.isNotBlank(string)) { return getString(string); } string = throwable.toString(); if (StringUtils.isNotBlank(string)) { return getString(string); } return Throwable.class.getSimpleName(); }
From source file:edu.uci.ics.asterix.result.ResultUtils.java
/** * Extract the meaningful part of a stack trace: * a. the causes in the stack trace hierarchy * b. the top exception for each cause/* w w w . ja va2 s . c o m*/ * * @param e * @return the contacted message containing a and b. */ private static String extractErrorSummary(Throwable e) { StringBuilder errorMessageBuilder = new StringBuilder(); Throwable cause = e; errorMessageBuilder.append(cause.getLocalizedMessage()); while (cause != null) { StackTraceElement[] stackTraceElements = cause.getStackTrace(); errorMessageBuilder .append(stackTraceElements.length > 0 ? "\n caused by: " + stackTraceElements[0] : ""); cause = cause.getCause(); } return errorMessageBuilder.toString(); }
From source file:org.polymap.core.workbench.PolymapWorkbench.java
/** * Handle the given error by opening an error dialog and logging the given * message to the CorePlugin log.// w w w .j a v a 2 s . c o m * * @param src * @param msg The error message. If null, then a standard message is used. * @param e The reason of the error, must not be null. */ public static void handleError(final String pluginId, Object src, final String msg, final Throwable e) { log.error(msg, e); final Status status = new Status(IStatus.ERROR, pluginId, e.getLocalizedMessage(), e); CorePlugin.getDefault().getLog().log(status); final Display display = Polymap.getSessionDisplay(); if (display == null) { log.error("No display -> no error message."); return; } Runnable runnable = new Runnable() { public void run() { try { Status displayStatus = status; if (e.getCause() != null) { displayStatus = new MultiStatus(pluginId, status.getCode(), status.getMessage(), status.getException()); for (Throwable cause = e.getCause(); cause != null; cause = cause.getCause()) { Status next = new Status(IStatus.ERROR, pluginId, e.getLocalizedMessage(), cause); ((MultiStatus) displayStatus).add(next); } } Shell shell = getShellToParentOn(); ErrorDialog dialog = new ErrorDialog(shell, Messages.get("PolymapWorkbench_errorDialogTitle"), msg != null ? msg : "Fehler beim Ausfhren der Operation.", displayStatus, IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR); // dialog.setBlockOnOpen( true ); dialog.open(); } catch (Throwable ie) { log.warn(ie); } } }; // if (Display.getCurrent() == display) { // runnable.run(); // } // else { display.asyncExec(runnable); // } }