Example usage for java.lang Throwable getMessage

List of usage examples for java.lang Throwable getMessage

Introduction

In this page you can find the example usage for java.lang Throwable getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.evolveum.midpoint.model.impl.controller.ModelUtils.java

public static void recordFatalError(OperationResult result, Throwable e) {
    recordFatalError(result, e.getMessage(), e);
}

From source file:de.tudarmstadt.ukp.dkpro.core.api.lexmorph.tagset.MappingsTest.java

public static void assertTagsetMapping(Collection<File> files) throws IOException {
    for (File file : files) {
        boolean failure = false;
        System.out.printf("== %s ==%n", file.getName());
        MappingProvider mappingProvider = new MappingProvider();
        mappingProvider.setDefault(MappingProvider.LOCATION, file.toURI().toURL().toString());
        mappingProvider.configure();//from   w w w . j  a  va2s  .  c o  m
        for (String tag : mappingProvider.getTags()) {
            String typeName = mappingProvider.getTagTypeName(tag);
            try {
                Class.forName(typeName);
            } catch (Throwable e) {
                System.out.printf("%s FAILED: %s %n", tag, e.getMessage());
                failure = true;
            }
        }
        assertFalse(failure);
    }
}

From source file:com.evolveum.midpoint.model.impl.controller.ModelUtils.java

public static void recordPartialError(OperationResult result, Throwable e) {
    recordPartialError(result, e.getMessage(), e);
}

From source file:com.vaadin.grails.VaadinUtils.java

/**
 * Localization methods, providing access to i18n values.
 * /*from   w  ww . ja v a  2 s .  c o m*/
 * @param key
 *            for localization properties
 * @param args
 *            arguments, e.g. "Hallo {0}"
 * @param locale
 *            locale
 * @return value from properties file or key (if key value is not found)
 */
public static String i18n(final String key, final Object[] args, final Locale locale) {
    String message = null;
    try {
        message = VaadinUtils.getMessageSource().getMessage(key, args, locale);
    } catch (final Throwable t) {
        System.err.println(t.getMessage());
    }
    if (message == null) {
        // if fetching values fails, return the key
        message = "[" + key + "]";
    }
    return message;
}

From source file:com.vaadin.grails.VaadinUtils.java

/**
 * Localization methods, providing access to i18n values.
 * //from   www.  j  ava2 s . c  o  m
 * @param key
 *            for localization properties
 * @param args
 *            arguments, e.g. "Hello {0}"
 * @defaultValue
 * @param locale
 *            locale
 * @return value from properties file or key (if key value is not found)
 */
public static String i18n(final String key, final Object[] args, final String defaultValue,
        final Locale locale) {
    String message = null;
    try {
        message = VaadinUtils.getMessageSource().getMessage(key, args, defaultValue, locale);
    } catch (final Throwable t) {
        System.err.println(t.getMessage());
    }
    if (message == null) {
        // if fetching values fails, return the key
        message = "[" + key + "]";
    }
    return message;
}

From source file:Main.java

public static String getExceptionStackTrace(Throwable throwable) {
    if (null == throwable) {
        return "null";
    }/* w w w.  j  a va 2  s.com*/
    StringBuilder sb = new StringBuilder(throwable.getMessage()).append("\n");
    StackTraceElement[] elements = throwable.getStackTrace();
    for (StackTraceElement element : elements) {
        sb.append(element.toString()).append("\r\n");
    }
    return sb.toString();
}

From source file:ch.cern.dss.teamcity.server.AsyncTagRequestController.java

/**
 * @param e//from  w  w  w  . j a v  a2 s .c  o  m
 *
 * @return
 */
static private String getMessageWithNested(Throwable e) {
    String result = e.getMessage();
    Throwable cause = e.getCause();
    if (cause != null) {
        result += " Caused by: " + getMessageWithNested(cause);
    }
    return result;
}

From source file:info.devopsabyss.CallSeleniumTest.java

private static String messageWithoutNewlines(final Throwable ex) {
    return withoutNewlines(ex.getMessage());
}

From source file:Main.java

private static void handlePluginException(Throwable throwable) {
    System.err.println((new StringBuilder()).append("RxJavaErrorHandler threw an Exception. It shouldn't. => ")
            .append(throwable.getMessage()).toString());
    throwable.printStackTrace();/*from   w w  w  . ja  va  2  s  . c  om*/
}

From source file:de.micromata.genome.gwiki.utils.ScriptUtils.java

public static Object invokeScriptFunktion(Object obj, String method, Object... args) {
    if (obj == null) {
        return null;
    }// w w w. java 2s  .  co  m
    try {
        return InvokerHelper.invokeMethod(obj, method, args);
    } catch (Throwable ex) {
        throw new RuntimeException("Cannot execute script Method: " + ex.getMessage(), ex);
    }
}