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.admin.customize.category.report.execute.ReportExecuteBL.java

/**
 * Get the FieldType by class name/*from  w ww . ja v a 2s.  c  om*/
 *
 * @param fieldTypeClassName
 * @return
 */
public static IPluggableDatasource pluggableDatasouceFactory(String pluggableDatasouceClassName) {
    Class pluggableDatasouceClass = null;
    if (pluggableDatasouceClassName == null) {
        LOGGER.warn("No PluggableDatasource specified ");
        return null;
    }
    try {
        pluggableDatasouceClass = Class.forName(pluggableDatasouceClassName);
    } catch (final ClassNotFoundException e) {
        LOGGER.error("The PluggableDatasouce class " + pluggableDatasouceClassName
                + "  not found found in the classpath " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (pluggableDatasouceClass != null) {
        try {
            return (IPluggableDatasource) pluggableDatasouceClass.newInstance();
        } catch (final Exception e) {
            LOGGER.error("Instantiating the PluggableDatasouce class " + pluggableDatasouceClassName
                    + "  failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
    }
    return null;
}

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

/**
 * Loads the screenTab by primary key/*from   w  w  w.  j a v a  2  s  .  c  o  m*/
 * @param objectID
 * @return
 */
@Override
public TScreenTabBean loadByPrimaryKey(Integer objectID) {
    TScreenTab tobject = null;
    try {
        tobject = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading of a screenTab by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    TScreenTabBean result = null;
    if (tobject != null) {
        result = tobject.getBean();
    }
    return result;
}

From source file:com.bloomreach.zk.replicate.ZookeeperDataReplicator.java

/**
 * Replicate data to Destination Zk based on the incoming zk data structure
 * Refer {@link #ZookeeperDataReplicator(String destinationZkServer, String rootReplicatePath, ZkDataNode sourceZkData)}
 *//*  ww w . j a  v a2 s . c om*/
public void replicate() throws ZkDataTraversalException {
    try {
        ZKAccessUtils.validateAndCreateZkPath(zkHandle, sourceCloneZkPath, null);
        writeAndFlushData(sourceZkDataNode);
    } catch (Exception e) {
        throw new ZkDataTraversalException(ExceptionUtils.getStackTrace(e));
    }
}

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

@Override
public TLastExecutedQueryBean loadByPrimaryKey(Integer objectID) {
    TLastExecutedQueryBean lastExecutedQueryBean = null;
    try {//  ww w  .  j av  a 2 s.  co  m
        TLastExecutedQuery tobject = retrieveByPK(objectID);
        if (tobject != null) {
            lastExecutedQueryBean = tobject.getBean();
        }
    } catch (Exception e) {
        LOGGER.info(
                "Loading of a LastExecutedQuery by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    return lastExecutedQueryBean;
}

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

@Override
public String createJsonData(TFieldBean field, WorkItemContext workItemContext) {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    Integer parentID = workItemContext.getWorkItemBean().getSuperiorworkitem();
    if (parentID != null) {
        TWorkItemBean parentBean = null;
        try {/*from w  w  w .  j a  v  a2 s. c  o m*/
            parentBean = ItemBL.loadWorkItem(parentID);
        } catch (ItemLoaderException e) {
            LOGGER.error(ExceptionUtils.getStackTrace(e)); //To change body of catch statement use File | Settings | File Templates.
        }
        if (parentBean != null) {
            if (workItemContext.isUseProjectSpecificID()) {
                String projectSpecificID = ItemBL.getSpecificProjectID(parentBean);
                JSONUtility.appendStringValue(sb, "projectSpecificID", projectSpecificID);
            }
            String title = parentBean.getSynopsis();
            JSONUtility.appendStringValue(sb, "title", title, true);

        }
    }
    sb.append("}");
    return sb.toString();
}

From source file:com.trackplus.ddl.DataReaderTest.java

private static void exportSchema(File tmpDir, String dbaseDir) {
    String[] databases = new String[] { MetaDataBL.DATABASE_DB2, MetaDataBL.DATABASE_DERBY,
            MetaDataBL.DATABASE_FIREBIRD, MetaDataBL.DATABASE_MS_SQL, MetaDataBL.DATABASE_MY_SQL,
            MetaDataBL.DATABASE_ORACLE, MetaDataBL.DATABASE_POSTGRES };
    String[] commentPrefixes = new String[] { MetaDataBL.COMMENT_PREFIX_DB2, MetaDataBL.COMMENT_PREFIX_DERBY,
            MetaDataBL.COMMENT_PREFIX_FIREBIRD, MetaDataBL.COMMENT_PREFIX_MS_SQL,
            MetaDataBL.COMMENT_PREFIX_MY_SQL, MetaDataBL.COMMENT_PREFIX_ORACLE,
            MetaDataBL.COMMENT_PREFIX_POSTGRES };

    Logger logger = LogManager.getLogger(DataReader.class);

    for (int i = 0; i < databases.length; i++) {
        String dbName = databases[i];
        String schemaFileName = dbaseDir + File.separator + dbName + File.separator + "track-schema.sql";
        String idTableFileName = dbaseDir + File.separator + dbName + File.separator + "id-table-schema.sql";
        String commentPrefix = commentPrefixes[i];
        InputStream is = null;/* ww w.j a  va  2s . c o  m*/
        InputStream isIdTable = null;
        try {
            is = new FileInputStream(schemaFileName);
            isIdTable = new FileInputStream(idTableFileName);
        } catch (FileNotFoundException e) {
            logger.error(ExceptionUtils.getStackTrace(e));
        }
        try {
            MetaDataBL.splitSchema(is, isIdTable, tmpDir.getAbsolutePath(), commentPrefix, dbName);
        } catch (DDLException e) {
            logger.error(ExceptionUtils.getStackTrace(e));
        }
    }
}

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

/**
 * Loads the DashboardTab by primary key
 * @param objectID/*from  w  w  w.j av a  2 s  .  co m*/
 * @return
 */
@Override
public TDashboardTabBean loadByPrimaryKey(Integer objectID) {
    TDashboardTab tobject = null;
    try {
        tobject = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading of a DashboardTab by primary key " + objectID + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    TDashboardTabBean result = null;
    if (tobject != null) {
        result = tobject.getBean();
    }
    return result;
}

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

/**
 * Gets a TWorkflowConnectBean by promary key
 * @param objectID/*from   w w w  .  j ava  2s. c  o  m*/
 * @return
 */
@Override
public TWorkflowConnectBean loadByPrimaryKey(Integer objectID) {
    TWorkflowConnect tobject = null;
    try {
        tobject = retrieveByPK(objectID);
    } catch (Exception e) {
        LOGGER.warn("Loading of a screenConfig 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.aurel.track.screen.dashboard.bl.DashboardUtil.java

public static IPluginDashboard getPlugin(String className) {
    if (cachePlugins == null) {
        cachePlugins = new HashMap();
    }/*  w ww  .ja  va2 s.  co  m*/
    Class pluginClass = (Class) cachePlugins.get(className);
    if (pluginClass == null) {
        try {
            pluginClass = Class.forName(className);
        } catch (ClassNotFoundException e) {
            LOGGER.error(ExceptionUtils.getStackTrace(e));
            return null;
        }
        cachePlugins.put(className, pluginClass);
    }
    try {
        IPluginDashboard plugin = (IPluginDashboard) pluginClass.newInstance();
        return plugin;
    } catch (InstantiationException e) {
        LOGGER.error(ExceptionUtils.getStackTrace(e));
    } catch (IllegalAccessException e) {
        LOGGER.error(ExceptionUtils.getStackTrace(e));
    }
    return null;//plugin class problem
}

From source file:com.aurel.track.fieldType.runtime.matchers.run.BooleanMatcherRT.java

/**
 * Whether the value matches or not/*from   ww  w.ja va  2s .  c  o m*/
 * @param attributeValue
 * @return
 */
@Override
public boolean match(Object attributeValue) {
    Boolean nullMatch = nullMatcher(attributeValue);
    if (nullMatch != null) {
        return nullMatch.booleanValue();
    }
    if (attributeValue == null) {
        return false;
    }
    Boolean attributeValueBoolean = null;
    try {
        attributeValueBoolean = (Boolean) attributeValue;
    } catch (Exception e) {
        LOGGER.error("Converting the attribute value " + attributeValue + " of type "
                + attributeValue.getClass().getName() + " to Boolean failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        return false;
    }
    switch (relation) {
    case MatchRelations.SET:
        return attributeValueBoolean.booleanValue();
    case MatchRelations.RESET:
        return !attributeValueBoolean.booleanValue();
    default:
        return false;
    }
}