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

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

Introduction

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

Prototype

public static String getStackTrace(final Throwable throwable) 

Source Link

Document

Gets the stack trace from a Throwable as a String.

The result of this method vary by JDK version as this method uses Throwable#printStackTrace(java.io.PrintWriter) .

Usage

From source file:com.aurel.track.exchange.excel.ExcelFieldMatchBL.java

/**
 * Get the workbook and returns its sheets
 * @param excelMappingsDirectory/*from w ww  . j a v  a  2s. c  om*/
  * @param fileName
 * @return Map<SheetID, SheetName>
 */
static Workbook loadWorkbook(String excelMappingsDirectory, String fileName) {
    FileInputStream inputStream = null;
    try {
        inputStream = new FileInputStream(new File(excelMappingsDirectory, fileName));
    } catch (FileNotFoundException e) {
        LOGGER.warn("Loading the workbook from directory " + excelMappingsDirectory + " and file " + fileName
                + "  failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        return null;
    }
    try {
        if (fileName.endsWith("xls") || fileName.endsWith("XLS")) {
            return new HSSFWorkbook(inputStream);
        } else {
            if (fileName.endsWith("xlsx") || fileName.endsWith("XLSX")) {
                return new XSSFWorkbook(inputStream);
            }
        }
    } catch (IOException e) {
        LOGGER.warn("Getting the excel sheets failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    return null;
}

From source file:com.aurel.track.persist.TScriptsPeer.java

/**
 * Loads the script by primary key/*w  w  w. jav a2 s . c  o m*/
 * @param objectID
 * @return
 */
@Override
public TScriptsBean loadByPrimaryKey(Integer objectID) {
    TScripts tScript = null;
    try {
        tScript = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading of a script by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (tScript != null) {
        return tScript.getBean();
    }
    return null;
}

From source file:com.aurel.track.persist.TCostCenterPeer.java

/**
 * Loads a cost center by primary key/*ww w .  j  a v  a 2s .c  o m*/
 * @param objectID
 * @return
 */
@Override
public TCostCenterBean loadByPrimaryKey(Integer objectID) {
    TCostCenter tCostCenter = null;
    try {
        tCostCenter = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading the costcenter by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (tCostCenter != null) {
        return tCostCenter.getBean();
    }
    return null;
}

From source file:com.aurel.track.persist.TMSProjectTaskPeer.java

/**
 * Loads an MsProjectTaskBean by primary key
 * @param objectID/*from   www  .  j a  v a2s . c om*/
 * @return 
 */
@Override
public TMSProjectTaskBean loadByPrimaryKey(Integer objectID) {
    TMSProjectTask msProjectTask = null;
    try {
        msProjectTask = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn(
                "Loading of an msProject task by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (msProjectTask != null) {
        return msProjectTask.getBean();
    }
    return null;
}

From source file:com.aurel.track.screen.dashboard.action.DashboardPluginListAction.java

public String list() {
    locale = (Locale) session.get(Constants.LOCALE_KEY);
    if (locale == null) {
        locale = Locale.getDefault();
    }//from   w w w  . ja  v a2  s  . c  om
    List<DashboardDescriptor> pluginList = DashboardUtil.getDashboardPlugins();
    try {
        JSONUtility.prepareServletResponseJSON(ServletActionContext.getResponse());
        PrintWriter out = ServletActionContext.getResponse().getWriter();
        out.println(encodePluginList(pluginList));
    } catch (IOException e) {
        LOGGER.error(ExceptionUtils.getStackTrace(e));
    }
    return null;

}

From source file:com.aurel.track.persist.TCardPanelPeer.java

@Override
public TCardPanelBean loadByPrimaryKey(Integer objectID) {
    TCardPanel tobject = null;/*w w  w .  j  a  v a  2s.c  o  m*/
    try {
        tobject = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.info("Loading of a cardPanel by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (tobject != null) {
        return tobject.getBean();
    }
    return null;
}

From source file:com.azaptree.services.command.impl.CommandExcecutionMetric.java

@Override
public String toString() {
    final StringBuilder sb = new StringBuilder(256);
    sb.append("CommandExcecutionMetric [key=");
    key.toString(sb);/*from   www.  j  a v a 2  s .c o m*/
    sb.append(", executionTimeStart=")
            .append(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(executionTimeStart));
    sb.append(", executionTime=").append(executionTimeEnd - executionTimeStart).append(" msec, success=")
            .append(success);
    if (throwable != null) {
        sb.append(", throwable=").append(ExceptionUtils.getStackTrace(throwable));
    }
    sb.append(']');

    return sb.toString();
}

From source file:com.aurel.track.dbase.DatabaseHandler.java

/**
 * Delete the test database in case there is one. First
 * stop the database server in case it is running.
 *///from  w w w . j  av a 2s . c  o m
public static void cleanDatabase() {
    try {
        stopDbServer();
        File testDB = new File("TestDB");
        if (testDB.exists() && testDB.isDirectory()) {
            FileUtils.deleteDirectory(testDB);
            LOGGER.info("TestDB deleted.");
        }
    } catch (Exception e) {
        LOGGER.error(ExceptionUtils.getStackTrace(e));
    }
}

From source file:jp.co.ipublishing.esnavi.impl.shelter.ShelterClient.java

@NonNull
@Override/*  w w  w .j  a  va2  s .  c  o m*/
public Observable<ShelterStatuses> downloadStatuses() {
    return Observable.create(new Observable.OnSubscribe<ShelterStatuses>() {
        @Override
        public void call(Subscriber<? super ShelterStatuses> subscriber) {
            final ApiMethod apiMethod = mApi.downloadStatuses();

            try {
                final Request request = new Request.Builder().url(apiMethod.getUrl()).get().build();

                final Response response = mClient.newCall(request).execute();
                final String result = response.body().string();

                final ShelterStatuses statuses = ShelterFactory.createStatuses(result);

                subscriber.onNext(statuses);
                subscriber.onCompleted();
            } catch (IOException | JSONException | ParseException e) {
                Log.e(TAG, ExceptionUtils.getStackTrace(e));

                subscriber.onError(e);
            }
        }
    });
}

From source file:com.aurel.track.persist.TLinkTypePeer.java

/**
 * Loads a linkTypeBean by primary key/*from ww w .j  a  va 2s .  co  m*/
 * @param objectID
 * @return 
 */
@Override
public TLinkTypeBean loadByPrimaryKey(Integer objectID) {
    TLinkType tLinkType = null;
    try {
        tLinkType = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.info("Loading of a linkType by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (tLinkType != null) {
        return tLinkType.getBean();
    }
    return null;
}