Example usage for java.lang Throwable toString

List of usage examples for java.lang Throwable toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:org.sonatype.siesta.FaultXO.java

public FaultXO(final String id, final Throwable cause) {
    this(id, cause.toString());
}

From source file:com.ning.billing.invoice.dao.InvoiceDaoTestBase.java

@BeforeClass()
protected void setup() throws IOException {
    // Health check test to make sure MySQL is setup properly
    try {//from w  ww  .j  a  va  2 s  .  c om
        InvoiceModuleMock module = new InvoiceModuleMock();
        final String ddl = IOUtils
                .toString(DefaultInvoiceDao.class.getResourceAsStream("/com/ning/billing/invoice/ddl.sql"));
        module.createDb(ddl);

        final Injector injector = Guice.createInjector(Stage.DEVELOPMENT, module);

        invoiceDao = injector.getInstance(InvoiceDao.class);
        invoiceDao.test();

        invoiceItemDao = module.getInvoiceItemDao();

        EventBusService busService = injector.getInstance(EventBusService.class);
        ((DefaultEventBusService) busService).startBus();
    } catch (Throwable t) {
        fail(t.toString());
    }
}

From source file:com.albert.util.StringUtilCommon.java

public static String stackToString(Throwable cause) {
    if (cause == null)
        return "";
    try {//w w  w. j a  v a  2 s  . c o m
        //cause.printStackTrace();
        StringWriter sw = new StringWriter();
        cause.printStackTrace(new PrintWriter(sw));
        String stackTrace = sw.toString();
        return stackTrace;
    } catch (Exception e) {
        return cause.toString();
    }
}

From source file:org.a3badran.platform.logging.ErrorHandler.java

@Override
public void handleError(Throwable t) {
    if (t instanceof IllegalStateException) {
        RequestLogger.addWarning(t.toString());
    } else {// w w w  . ja  v  a  2 s  .c o m
        RequestLogger.addError(t.toString());
    }
}

From source file:ar.com.zauber.commons.dao.exception.TriggeredException.java

/** @see java.lang.Throwable#getMessage() */
public final String getMessage() {
    String message = (this.getClass().getSimpleName());
    if (!this.exceptions.isEmpty()) {
        message += "The following Exceptions ocurred:\n";
        for (Throwable t : exceptions) {
            message += t.toString() + "\n\n";
        }//from w w w .j  ava2 s .c  om
    }
    return message;
}

From source file:edu.harvard.mcz.imagecapture.exceptions.ConnectionException.java

/**
 * @param cause
 */
public ConnectionException(Throwable cause) {
    super(cause);
    log.debug(cause.toString());
}

From source file:com.ning.billing.account.dao.AccountDaoTestBase.java

@BeforeClass(alwaysRun = true)
protected void setup() throws IOException {
    // Health check test to make sure MySQL is setup properly
    try {// ww  w .j a va2s  .co m
        module = new AccountModuleMock();
        final String accountDdl = IOUtils
                .toString(AccountSqlDao.class.getResourceAsStream("/com/ning/billing/account/ddl.sql"));
        final String invoiceDdl = IOUtils
                .toString(AccountSqlDao.class.getResourceAsStream("/com/ning/billing/invoice/ddl.sql"));
        final String utilDdl = IOUtils
                .toString(AccountSqlDao.class.getResourceAsStream("/com/ning/billing/util/ddl.sql"));

        module.startDb();
        module.initDb(accountDdl);
        module.initDb(invoiceDdl);
        module.initDb(utilDdl);

        final Injector injector = Guice.createInjector(Stage.DEVELOPMENT, module);
        dbi = injector.getInstance(IDBI.class);

        accountDao = injector.getInstance(AccountDao.class);
        accountDao.test();

        EventBusService busService = injector.getInstance(EventBusService.class);
        ((DefaultEventBusService) busService).startBus();
    } catch (Throwable t) {
        fail(t.toString());
    }
}

From source file:com.newlandframework.rpc.netty.MessageRecvInitializeTask.java

public Boolean call() {
    response.setMessageId(request.getMessageId());
    try {/*from www .  java 2  s .c  o m*/
        Object result = reflect(request);
        response.setResult(result);
        return Boolean.TRUE;
    } catch (Throwable t) {
        response.setError(t.toString());
        t.printStackTrace();
        System.err.printf("RPC Server invoke error!\n");
        return Boolean.FALSE;
    }
}

From source file:com.vmware.photon.controller.api.client.resource.AuthApiTest.java

@Test
public void testGetAuthStatusAsync() throws IOException, InterruptedException {
    final Auth auth = new Auth();

    ObjectMapper mapper = new ObjectMapper();
    String serialized = mapper.writeValueAsString(auth);

    setupMocks(serialized, HttpStatus.SC_OK);

    AuthApi authApi = new AuthApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    authApi.getAuthStatusAsync(new FutureCallback<Auth>() {
        @Override//  w w w .  j av a2  s .  c  o m
        public void onSuccess(@Nullable Auth result) {
            assertEquals(result, auth);
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });
}

From source file:com.vmware.photon.controller.api.client.resource.AuthRestApiTest.java

@Test
public void testGetAuthStatusAsync() throws IOException, InterruptedException {
    final Auth auth = new Auth();

    ObjectMapper mapper = new ObjectMapper();
    String serialized = mapper.writeValueAsString(auth);

    setupMocks(serialized, HttpStatus.SC_OK);

    AuthApi authApi = new AuthRestApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    authApi.getAuthStatusAsync(new FutureCallback<Auth>() {
        @Override/*ww w .  j av a2 s. c  o m*/
        public void onSuccess(@Nullable Auth result) {
            assertEquals(result, auth);
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });
}