Example usage for org.apache.commons.lang3.exception ExceptionUtils getMessage

List of usage examples for org.apache.commons.lang3.exception ExceptionUtils getMessage

Introduction

In this page you can find the example usage for org.apache.commons.lang3.exception ExceptionUtils getMessage.

Prototype

public static String getMessage(final Throwable th) 

Source Link

Document

Gets a short message summarising the exception.

Usage

From source file:com.mingo.executor.QueryExecutorFactory.java

/**
 * Creates query executor./*from   ww  w  .j  ava  2s  .c om*/
 *
 * @param host database host
 * @param port database port
 * @param context mingo context {@link Context}
 * @return query executor {@link QueryExecutor}
 */
public static QueryExecutor create(String host, int port, Context context) {
    QueryExecutor queryExecutor = null;
    try {
        queryExecutor = create(new Mongo(host, port), context);
    } catch (UnknownHostException e) {
        LOGGER.error(ExceptionUtils.getMessage(e));
    }
    return queryExecutor;
}

From source file:com.mingo.parser.xml.dom.ParseErrorHandler.java

/**
 * {@inheritDoc}//from  w  ww  .jav a 2  s . c o  m
 */
@Override
public void warning(SAXParseException ex) throws SAXException {
    LOGGER.warn(ExceptionUtils.getMessage(ex));
}

From source file:com.galenframework.ide.model.results.CommandExecutionResult.java

public static CommandExecutionResult error(Throwable ex) {
    CommandExecutionResult result = new CommandExecutionResult();
    result.setStatus(ExecutionStatus.failed);
    result.setErrorMessages(/* www  .  ja v a2s . co  m*/
            Collections.singletonList(ExceptionUtils.getMessage(ex) + "\n" + ExceptionUtils.getStackTrace(ex)));
    return result;
}

From source file:com.mingo.parser.xml.dom.ParseErrorHandler.java

/**
 * {@inheritDoc}
 */
@Override
public void error(SAXParseException ex) throws SAXException {
    LOGGER.error(ExceptionUtils.getMessage(ex));
}

From source file:com.galenframework.reports.ExceptionReportNode.java

@Override
public String getName() {
    return ExceptionUtils.getMessage(exception);
}

From source file:com.baasbox.service.scripting.js.Api.java

public static String execCommand(String commandStr, JsonCallback callback) {
    BaasBoxLogger.debug("Command to execute: " + commandStr);
    try {/* www . j  av a  2  s  .c  om*/
        JsonNode node = Json.mapper().readTree(commandStr);
        if (!node.isObject()) {
            BaasBoxLogger.error("Command is not an object");
            throw ECMAErrors.typeError("Invalid command");
        }
        ObjectNode o = (ObjectNode) node;
        String main = mainModule();
        if (main != null) {
            o.put("main", main);
        }
        JsonNode exec = CommandRegistry.execute(node, callback);
        String res = exec == null ? null : exec.toString();
        BaasBoxLogger.debug("Command result: " + res);
        return res;
    } catch (IOException e) {
        BaasBoxLogger.error("IoError " + ExceptionUtils.getMessage(e), e);
        throw ECMAErrors.typeError(e, "Invalid command definition");
    } catch (CommandException e) {
        BaasBoxLogger.error("CommandError: " + ExceptionUtils.getMessage(e), e);
        throw new ECMAException(ExceptionUtils.getMessage(e), e);
    }
}

From source file:com.mingo.parser.xml.dom.ParserFactory.java

/**
 * Creates parser./*from   www .j  a va 2s.c  o  m*/
 *
 * @param parseComponent parse component {@link ParseComponent}
 * @param <T>            class
 * @return implementation of {@link Parser}
 */
public static <T> Parser<T> createParser(ParseComponent parseComponent) {
    Parser xmlParser = null;
    try {
        switch (parseComponent) {
        case CONTEXT:
            xmlParser = new ContextConfigurationParser(createValidatedConfiguration(CONTEXT_XSD),
                    DEFAULT_PARSE_ERROR_HANDLER);
            break;
        case QUERY:
            xmlParser = new QuerySetParser(createValidatedConfiguration(QUERY_XSD),
                    DEFAULT_PARSE_ERROR_HANDLER);
            break;
        default:
            xmlParser = null;
        }
    } catch (ParserConfigurationException ex) {
        LOGGER.error(ExceptionUtils.getMessage(ex));
    }
    return xmlParser;
}

From source file:de.tuberlin.uebb.jbop.exception.JBOPClassExceptionTest.java

/**
 * Test creation of {@link JBOPClassException}.
 *//* w w  w.j  ava2s.  co m*/
@Test
public void testJBOPClassException() {
    final JBOPClassException jBOPClassException = new JBOPClassException(message, cause);
    try {
        throw jBOPClassException;
    } catch (final Throwable jce) {
        assertEquals(jce.getClass().getSimpleName() + ": " + message, ExceptionUtils.getMessage(jce));
        assertEquals(cause, ExceptionUtils.getRootCause(jce));
    }
}

From source file:com.mingo.executor.QueryExecutorFactory.java

/**
 * Creates query executor./*from  w w w .j  a  v a 2  s . co  m*/
 *
 * @param context mingo context {@link Context}
 * @return query executor {@link QueryExecutor}
 */
public static QueryExecutor create(Context context) {
    QueryExecutor queryExecutor = null;
    Validate.notNull(context, "context cannot be null");
    try {
        queryExecutor = create(new MongoClient(context.getDatabaseHost(), context.getDatabasePort()), context);
    } catch (UnknownHostException e) {
        LOGGER.error(ExceptionUtils.getMessage(e));
    }
    return queryExecutor;

}

From source file:com.svds.example.geolocation.maxmind.IntegratedTest_When_Querying_The_MaxMind_GeoLocation_Database_For_A_Valid_IP_Address.java

@Test
@Ignore // Need to purchase a license for the ISP database file
public void Then_It_Should_Not_Throw_An_Error() {
    try {/*w w w .  j av a  2s  .c o  m*/
        guice.getInstance(GeoLocationService.class).find(ipAddress);
    } catch (Exception e) {
        logger.error("An unexpected Exception was thrown while querying the MaxMind geo location database\n"
                + ExceptionUtils.getMessage(e), e);
        fail("An unexpected Exception was thrown while querying the MaxMind geo location database. See log for details.");
    }
}