java.lang.Error.addSuppressed()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中java.lang.Error.addSuppressed()方法的一些代码示例,展示了Error.addSuppressed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Error.addSuppressed()方法的具体详情如下:
包路径:java.lang.Error
类名称:Error
方法名:addSuppressed

Error.addSuppressed介绍

暂无

代码示例

代码示例来源:origin: real-logic/artio

public static synchronized void onOpen(final String resourceId, final Object owner)
{
  if (CLOSE_CHECKER_ENABLED)
  {
    try
    {
      throw new Exception();
    }
    catch (final Exception e)
    {
      final Resource resource = RESOURCES.computeIfAbsent(
        resourceId, (key) -> new Resource());
      final Exception oldException = resource.currentlyOpen.put(owner, e);
      if (oldException != null)
      {
        final Error error = error(resourceId, owner);
        error.addSuppressed(oldException);
        throw error;
      }
    }
  }
}

代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-test

eachField.set(condition, eachValue);
} catch (IllegalArgumentException | IllegalAccessException cause) {
  errors.addSuppressed(new Error("Cannot inject " + eachField.getName(), cause));

代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-test

} catch (AssumptionViolatedException cause) {
  Throwable t = new Throwable("On retry " + retry, cause);
  error.addSuppressed(t);
  notifier.fireTestAssumptionFailed(new Failure(description, t));
} catch (Throwable cause) {
  error.addSuppressed(t);
  if (returnOnFailure()) {
    notifier.fireTestFailure(new Failure(description, t));

相关文章