当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionUtils.getStackTrace方法代码示例

本文整理汇总了Java中org.apache.commons.lang.exception.ExceptionUtils.getStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionUtils.getStackTrace方法的具体用法?Java ExceptionUtils.getStackTrace怎么用?Java ExceptionUtils.getStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.exception.ExceptionUtils的用法示例。


在下文中一共展示了ExceptionUtils.getStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enterStatistics

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Authenticated
@Override
public synchronized String enterStatistics(String name, Long instanceCount, Integer fetchUI, Integer maxFetchUI,
                                           Integer lazyCollectionThreshold, Integer lookupScreenThreshold) {
    if (StringUtils.isBlank(name))
        return "Entity name is required";
    try {
        EntityStatistics es = persistenceManager.enterStatistics(
                name, instanceCount, fetchUI, maxFetchUI, lazyCollectionThreshold, lookupScreenThreshold);

        StringBuilder sb = new StringBuilder("Statistics for ").append(name).append(" changed:\n");
        sb.append("instanceCount=").append(es.getInstanceCount()).append("\n");
        sb.append("fetchUI=").append(es.getFetchUI()).append("\n");
        sb.append("maxFetchUI=").append(es.getMaxFetchUI()).append("\n");
        sb.append("lazyCollectionThreshold=").append(es.getLazyCollectionThreshold()).append("\n");
        sb.append("lookupScreenThreshold=").append(es.getLookupScreenThreshold()).append("\n");
        return sb.toString();
    } catch (Exception e) {
        log.error("enterStatistics error", e);
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:PersistenceManager.java

示例2: runGroovyScript

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Authenticated
@Override
public String runGroovyScript(String scriptName) {
    try {
        Binding binding = new Binding();
        binding.setVariable("persistence", persistence);
        binding.setVariable("metadata", metadata);
        binding.setVariable("configuration", configuration);
        binding.setVariable("dataManager", dataManager);
        Object result = scripting.runGroovyScript(scriptName, binding);
        return String.valueOf(result);
    } catch (Exception e) {
        log.error("Error runGroovyScript", e);
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:ScriptingManager.java

示例3: write

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
private void write(final Level level, final String message, final String jobName, final Object... args) {
    for (int i = 0; i < args.length; i++) {
        if (args[i] instanceof SQSTriggerQueue) {
            args[i] = ((SQSTriggerQueue) args[i]).getUrl();
        }
        else if (args[i] instanceof Throwable) {
            args[i] = ExceptionUtils.getStackTrace((Throwable)args[i]);
        }
    }

    StringBuilder source = new StringBuilder();
    if (this.autoFormat) {
        final String id = String.format("%06X", Thread.currentThread().getId());
        source
            .append("[").append(ClassUtils.getAbbreviatedName(this.clazz, 1)).append("]")
            .append("[thread-").append(id).append("]");
        if (StringUtils.isNotBlank(jobName)) {
            source.append("[job-").append(jobName).append("]");
        }
    }

    String msg = String.format(message, args);
    if (level == Level.CONFIG) {
        msg = "[DEBUG] " + msg;
    } else if (level == Level.SEVERE) {
        msg = "[ERROR] " + msg;
    }

    this.logger.logp(level, source.toString(), "", msg);
    if (this.streamHandler != null) {
        this.streamHandler.flush();
    }
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:34,代码来源:Log.java

示例4: display

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public static void display(String title, Throwable e) {
	String stackTrace = ExceptionUtils.getStackTrace(e);
	System.out.println(OBJECT_TITLE_OUT_PREFIX + title + ": "+e.getClass() + " " + e.getMessage());
	System.out.println(stackTrace);
	LOGGER.debug("{}{}: {} {}\n{}", new Object[]{
			OBJECT_TITLE_LOG_PREFIX, title, e.getClass(), e.getMessage(),
			stackTrace});
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:9,代码来源:IntegrationTestTools.java

示例5: updateDatabase

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Authenticated
@Override
public String updateDatabase(String token) {
    if (!"update".equals(token))
        return "Pass 'update' in the method parameter if you really want to update database.";
    try {
        dbUpdater.updateDatabase();
        return "Updated";
    } catch (Throwable e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:PersistenceManager.java

示例6: flushStatisticsCache

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public synchronized String flushStatisticsCache() {
    try {
        persistenceManager.flushStatisticsCache();
        return "Done";
    } catch (Exception e) {
        log.error("flushStatisticsCache error", e);
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:PersistenceManager.java

示例7: removeClass

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public String removeClass(String className) {
    try {
        boolean removed = scripting.removeClass(className);
        return removed ? format("Removed %s", className) : "No such class in cache";
    } catch (Exception e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:ClassLoaderManager.java

示例8: reloadClass

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public String reloadClass(String className) {
    try {
        javaClassLoader.removeClass(className);
        return loadClass(className);
    } catch (Exception e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:ClassLoaderManager.java

示例9: getClassDependencies

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public String getClassDependencies(String className) {
    try {
        if (javaClassLoader.isLoadedClass(className)) {
            return format("Dependencies \n%s\nDependent \n%s", javaClassLoader.getClassDependencies(className), javaClassLoader.getClassDependent(className));
        }
        return "No such class in cache";
    } catch (Exception e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:ClassLoaderManager.java

示例10: processScheduledTasks

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public String processScheduledTasks() {
    if (!AppContext.isStarted())
        return "Not started yet";

    try {
        scheduling.processScheduledTasks(false);
        return "Done";
    } catch (Throwable e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:Scheduling.java

示例11: getStackTrace

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
private String getStackTrace(Throwable throwable) {
    if (throwable instanceof RemoteException) {
        RemoteException re = (RemoteException) throwable;
        for (int i = re.getCauses().size() - 1; i >= 0; i--) {
            if (re.getCauses().get(i).getThrowable() != null) {
                throwable = re.getCauses().get(i).getThrowable();
                break;
            }
        }
    }

    return ExceptionUtils.getStackTrace(throwable);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:JXErrorPaneExt.java

示例12: sendError

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
private void sendError(HttpServletRequest request, HttpServletResponse response, Throwable e) throws IOException {
    log.error("Error processing request: " + request.getRequestURI() + "?" + request.getQueryString(), e);

    Configuration configuration = AppBeans.get(Configuration.class);
    boolean isProductionMode = configuration.getConfig(RestConfig.class).getProductionMode();

    String msg;
    if (isProductionMode) {
        msg = "Internal server error";
    } else {
        Throwable t = ExceptionUtils.getRootCause(e);
        msg = t != null ? ExceptionUtils.getStackTrace(t) : ExceptionUtils.getStackTrace(e);
    }
    response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:DataServiceController.java

示例13: jpqlLoadList

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Authenticated
@Override
public String jpqlLoadList(String queryString) {
    try {
        Transaction tx = persistence.createTransaction();
        try {
            EntityManager em = persistence.getEntityManager();
            Query query = em.createQuery(queryString);
            QueryParser parser = QueryTransformerFactory.createParser(queryString);
            Set<String> paramNames = parser.getParamNames();
            for (String paramName : paramNames) {
                security.setQueryParam(query, paramName);
            }
            List resultList = query.getResultList();
            tx.commit();

            StrBuilder sb = new StrBuilder();
            for (Object element : resultList) {
                if (element instanceof Object[]) {
                    sb.appendWithSeparators((Object[]) element, " | ");
                } else {
                    sb.append(element);
                }
                sb.append("\n");
            }
            return sb.toString();
        } finally {
            tx.end();
        }
    } catch (Throwable e) {
        log.error("jpqlLoadList error", e);
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:PersistenceManager.java

示例14: printDbProperties

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Authenticated
@Override
public String printDbProperties(String prefix) {
    try {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, String> entry : configStorage.getDbProperties().entrySet()) {
            if (prefix == null || entry.getKey().startsWith(prefix)) {
                sb.append(entry.getKey()).append("=").append(entry.getValue()).append("\n");
            }
        }
        return sb.toString();
    } catch (Exception e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:ConfigStorage.java

示例15: setDbProperty

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Authenticated
@Override
public String setDbProperty(String name, String value) {
    if (StringUtils.isBlank(name))
        return "Enter a property name";
    if (StringUtils.isBlank(value))
        return "Enter a property value";

    try {
        configStorage.setDbProperty(name, value);
        return "Property " + name + " set to " + value;
    } catch (Exception e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:ConfigStorage.java


注:本文中的org.apache.commons.lang.exception.ExceptionUtils.getStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。