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

x33g5p2x  于2022-01-17 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(206)

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

NullPointerException.addSuppressed介绍

暂无

代码示例

代码示例来源:origin: org.microbean/microbean-configuration-api

if (name == null) {
 final NullPointerException throwMe = new NullPointerException();
 throwMe.addSuppressed(this);
 throw throwMe;

代码示例来源:origin: net.java.truevfs/truevfs-comp-zipdriver

@CreatesObligation
public ZipInputService(
    final FsModel model,
    final FsInputSocketSource source,
    final AbstractZipDriver<E> driver)
throws IOException {
  super(source, driver);
  this.driver = driver;
  if (null == (this.model = model)) {
    final NullPointerException ex = new NullPointerException();
    try {
      super.close();
    } catch (final Throwable ex2) {
      ex.addSuppressed(ex2);
    }
    throw ex;
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@CreatesObligation
@edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION")
public ZipInputShop(
    final ZipDriver driver,
    final FsModel model,
    final @WillCloseWhenClosed ReadOnlyFile rof)
throws IOException {
  super(rof, driver);
  this.driver = driver;
  if (null == (this.model = model)) {
    final NullPointerException ex = new NullPointerException();
    try {
      super.close();
    } catch (final Throwable ex2) {
      if (JSE7.AVAILABLE) ex.addSuppressed(ex2);
    }
    throw ex;
  }
}

代码示例来源:origin: reactor/reactive-streams-commons

@Override
public void onError(Throwable t) {
  if (!second) {
    second = true;
    Publisher<? extends T> p;
    try {
      p = nextFactory.apply(t);
    } catch (Throwable e) {
      Throwable _e = ExceptionHelper.unwrap(e);
      _e.addSuppressed(t);
      ExceptionHelper.throwIfFatal(e);
      subscriber.onError(_e);
      return;
    }
    if (p == null) {
      NullPointerException t2 = new NullPointerException("The nextFactory returned a null Publisher");
      t2.addSuppressed(t);
      subscriber.onError(t2);
    } else {
      p.subscribe(this);
    }
  } else {
    subscriber.onError(t);
  }
}

相关文章