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.persist.TReportPersonSettingsPeer.java

/**
 * Loads a TReportPersonSettingsBean by primary key
 * @param objectID/*  w ww. j a v  a 2s  .com*/
 * @return
 */
@Override
public TReportPersonSettingsBean loadByPrimaryKey(Integer objectID) {
    TReportPersonSettings tReportPersonSettings = null;
    try {
        tReportPersonSettings = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading of TReportPersonSettings by primary key failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (tReportPersonSettings != null) {
        return tReportPersonSettings.getBean();
    }
    return null;

}

From source file:io.cloudslang.content.utils.OutputUtilities.java

/**
 * Creates a Map<String, String> with the RETURN_CODE Failure(-1), RETURN_RESULT the <throwable> message and with EXCEPTION the full stackTrace of the <throwable>
 *
 * @param throwable Exception with the message for the RETURN_RESULT and the fullStackTrace for the EXCEPTION of the map
 * @return a Map<String, String> with the RETURN_CODE Failure(-1), RETURN_RESULT the <throwable> message and with EXCEPTION the full stackTrace of the <throwable>
 *//*from w w  w. j  av  a  2  s.c  o m*/
@NotNull
public static Map<String, String> getFailureResultsMap(@NotNull final Throwable throwable) {
    final Map<String, String> results = new HashMap<>();
    results.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE);
    results.put(OutputNames.RETURN_RESULT, throwable.getMessage());
    results.put(OutputNames.EXCEPTION, ExceptionUtils.getStackTrace(throwable));
    return results;
}

From source file:com.aurel.track.fieldType.fieldChange.converter.ParentSetterConverter.java

/**
 * Gets the show value transformed form the stored configuration in database 
 * @param value//from   w  w  w  . j av  a2 s . c  o  m
 * @param fieldID
 * @param setter
 * @param locale
 * @return
 */
@Override
public String getDisplayValueFromStoredString(String value, Integer fieldID, Integer setter, Locale locale) {
    if (value != null) {
        Integer itemID = (Integer) getActualValueFromStoredString(value, setter);
        try {
            TWorkItemBean workItemBean = ItemBL.loadWorkItem(itemID);
            if (workItemBean != null) {
                return ItemBL.getItemNo(workItemBean) + " " + workItemBean.getSynopsis();
            }
        } catch (ItemLoaderException e) {
            LOGGER.info("Loading the item " + itemID + " failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
    }
    return null;
}

From source file:com.aurel.track.fieldType.fieldChange.apply.ParentFieldChangeApply.java

/**
 * Sets the workItemBean's attribute//from  ww  w .j  a v  a  2  s  .co m
 * @param workItemContext
 * @param workItemBean
 * @param fieldID
 * @param parameterCode
 * @param value   
 * @return ErrorData if an error is found
 */
@Override
public List<ErrorData> setWorkItemAttribute(WorkItemContext workItemContext, TWorkItemBean workItemBean,
        Integer parameterCode, Object value) {
    Integer parentID = null;
    try {
        parentID = (Integer) value;
    } catch (Exception e) {
        LOGGER.info("Getting the string value for " + value + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    switch (getSetter()) {
    case FieldChangeSetters.SET_TO:
        if (parentID != null) {
            if (ItemBL.isAscendant(workItemBean.getObjectID(), parentID)) {
                List<ErrorData> errorList = new LinkedList<ErrorData>();
                errorList.add(new ErrorData("itemov.massOperation.err.parentIsDescendant"));
                return errorList;
            } else {
                workItemBean.setAttribute(activityType, parameterCode, parentID);
            }
        }
        break;
    case FieldChangeSetters.SET_NULL:
        return super.setWorkItemAttribute(workItemContext, workItemBean, parameterCode, value);
    }
    //no error
    return null;
}

From source file:io.jare.tk.TkAppFallback.java

/**
 * Make fatal error page.//w  w  w  .j av  a2 s  . c o m
 * @param req Request
 * @return Response
 * @throws IOException If fails
 */
private static Response fatal(final RqFallback req) throws IOException {
    return new RsWithStatus(
            new RsWithType(new RsVelocity(TkAppFallback.class.getResource("error.html.vm"),
                    new RsVelocity.Pair("err", ExceptionUtils.getStackTrace(req.throwable())),
                    new RsVelocity.Pair("rev", TkAppFallback.REV)), "text/html"),
            HttpURLConnection.HTTP_INTERNAL_ERROR);
}

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

/**
 * Loads an TMSProjectExchangeBean by primary key
 * @param objectID//from   w w w  .ja v a  2s .c  om
 * @return 
 */
@Override
public TMSProjectExchangeBean loadByPrimaryKey(Integer objectID) {
    TMSProjectExchange msProjectExchange = null;
    try {
        msProjectExchange = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading of an msProjectExchange by primary key " + objectID + " failed with "
                + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (msProjectExchange != null) {
        return msProjectExchange.getBean();
    }
    return null;
}

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

public String getExceptionStacktrace() {
    if (testInfo.getException() != null) {
        return ExceptionUtils.getStackTrace(testInfo.getException());
    }/*from w  w w  .j  a  v a2s  . c om*/
    return null;
}

From source file:jp.co.ipublishing.aeskit.user.UserManager.java

/**
 * ??/*from w ww . j  av a2 s  . c  o  m*/
 *
 * @return Observable
 */
@NonNull
public Observable<Void> registerNotificationKey(@NonNull final Context context) {
    return Observable.create(new Observable.OnSubscribe<Void>() {
        @Override
        public void call(final Subscriber<? super Void> subscriber) {
            NotificationRegister.registerKey(context, mGcmSenderID).subscribe(new Subscriber<String>() {

                @Override
                public void onCompleted() {
                    // Nothing to do
                }

                @Override
                public void onError(Throwable e) {
                    Log.e(TAG, ExceptionUtils.getStackTrace(e));
                    subscriber.onError(e);
                }

                @Override
                public void onNext(String registrationKey) {
                    mClient.registerNotificationKey(registrationKey).subscribe(new Subscriber<Void>() {
                        @Override
                        public void onCompleted() {
                            subscriber.onCompleted();
                        }

                        @Override
                        public void onError(Throwable e) {
                            Log.e(TAG, ExceptionUtils.getStackTrace(e));
                            subscriber.onError(e);
                        }

                        @Override
                        public void onNext(Void aVoid) {
                            subscriber.onNext(null);
                            subscriber.onCompleted();
                        }
                    });
                }
            });
        }
    });
}

From source file:com.aurel.track.fieldType.runtime.renderer.CustomSelectRendererRT.java

@Override
public Object decodeJsonValue(String value, Integer fieldID, WorkItemContext workItemContext)
        throws TypeConversionException {
    Integer result = null;/*from   w  w w  .j a  v  a2s . c o m*/
    if (value != null) {
        try {
            result = Integer.decode(value);
        } catch (NumberFormatException ex) {
            LOGGER.error(ExceptionUtils.getStackTrace(ex));
            throw new TypeConversionException("common.err.invalid.number", ex);
        }
    }
    if (result == null) {
        return null;
    } else {
        return new Object[] { result };
    }
}

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

/**
 * @param application/*w  ww  .j  av  a2s  .  c om*/
 * @param torqueConfig
 * 
 * This will instantiate and configure a Quartz scheduler. Database related
 * configuration items are taken from the Torque configuration such as not
 * to duplicate JDBC URLs, database type, user, and password entries.
 * Some properties can be configured in file /WEB-INF/Quartz.properties,
 * for example configuration parameters for clustering.
 * 
 */
public static void init(ServletContext application, PropertiesConfiguration torqueConfig) {

    Properties qcfg = null;
    servletContext = application;
    try {
        URL quartzURL = application.getResource("/WEB-INF/Quartz.properties");
        qcfg = new Properties();
        InputStream in = quartzURL.openStream();
        qcfg.load(in);
        in.close();
    } catch (Exception e) {
        LOGGER.error("Getting the Quartz.properties failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (qcfg == null) {
        LOGGER.error("qcfg is null");
        return;
    }
    quartzProperties = qcfg;
}