本文整理了Java中java.io.IOException.getSuppressed()
方法的一些代码示例,展示了IOException.getSuppressed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOException.getSuppressed()
方法的具体详情如下:
包路径:java.io.IOException
类名称:IOException
方法名:getSuppressed
暂无
代码示例来源:origin: apache/kafka
static void checkException(IOException e, TestCloseable... closeablesWithException) {
assertEquals(closeablesWithException[0].closeException, e);
Throwable[] suppressed = e.getSuppressed();
assertEquals(closeablesWithException.length - 1, suppressed.length);
for (int i = 1; i < closeablesWithException.length; i++)
assertEquals(closeablesWithException[i].closeException, suppressed[i - 1]);
}
}
代码示例来源:origin: apache/asterixdb
public static void safeCopyFile(File child, File destChild) throws IOException {
forceMkdirs(destChild.getParentFile());
IOException ioException = null;
while (true) {
try {
FileUtils.copyFile(child, destChild);
return;
} catch (IOException e) {
if (ioException == null) {
ioException = e;
} else {
ioException.addSuppressed(e);
}
if (ioException.getSuppressed().length >= MAX_COPY_ATTEMPTS) {
LOGGER.warn("Unable to copy {} to {} after " + MAX_COPY_ATTEMPTS + " attempts; skipping file",
child, destChild, e);
return;
}
}
}
}
}
代码示例来源:origin: org.apache.sshd/sshd-core
Throwable[] suppressed = e.getSuppressed();
if (GenericUtils.length(suppressed) > 0) {
for (Throwable t : suppressed) {
代码示例来源:origin: org.apache.sshd/sshd-core
@Override
public void destroy() {
// NOTE !!! DO NOT NULL-IFY THE PROCESS SINCE "exitValue" is called subsequently
if (process != null) {
log.debug("Destroy process for " + cmdValue);
process.destroy();
}
IOException e = IoUtils.closeQuietly(getInputStream(), getOutputStream(), getErrorStream());
if (e != null) {
if (log.isDebugEnabled()) {
log.debug(e.getClass().getSimpleName() + " while destroy streams of '" + this + "': " + e.getMessage());
}
if (log.isTraceEnabled()) {
Throwable[] suppressed = e.getSuppressed();
if (GenericUtils.length(suppressed) > 0) {
for (Throwable t : suppressed) {
log.trace("Suppressed " + t.getClass().getSimpleName() + ") while destroy streams of '" + this + "': " + t.getMessage());
}
}
}
}
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
Throwable[] suppressed = e.getSuppressed();
if (GenericUtils.length(suppressed) > 0) {
for (Throwable t : suppressed) {
代码示例来源:origin: org.apache.sshd/sshd-osgi
@Override
public void destroy() {
// NOTE !!! DO NOT NULL-IFY THE PROCESS SINCE "exitValue" is called subsequently
if (process != null) {
log.debug("Destroy process for " + cmdValue);
process.destroy();
}
IOException e = IoUtils.closeQuietly(getInputStream(), getOutputStream(), getErrorStream());
if (e != null) {
if (log.isDebugEnabled()) {
log.debug(e.getClass().getSimpleName() + " while destroy streams of '" + this + "': " + e.getMessage());
}
if (log.isTraceEnabled()) {
Throwable[] suppressed = e.getSuppressed();
if (GenericUtils.length(suppressed) > 0) {
for (Throwable t : suppressed) {
log.trace("Suppressed " + t.getClass().getSimpleName() + ") while destroy streams of '" + this + "': " + t.getMessage());
}
}
}
}
}
代码示例来源:origin: org.apache.sshd/sshd-core
@Override
protected void preClose() {
if (!isEofSent()) {
log.debug("close({}) prevent sending EOF", this);
}
try {
signalChannelClosed(null);
} finally {
// clear the listeners since we are closing the channel (quicker GC)
this.channelListeners.clear();
}
IOException err = IoUtils.closeQuietly(getLocalWindow(), getRemoteWindow());
if (err != null) {
if (log.isDebugEnabled()) {
log.debug("Failed (" + err.getClass().getSimpleName() + ") to pre-close window(s) of " + this + ": " + err.getMessage());
}
if (log.isTraceEnabled()) {
Throwable[] suppressed = err.getSuppressed();
if (GenericUtils.length(suppressed) > 0) {
for (Throwable t : suppressed) {
log.trace("Suppressed " + t.getClass().getSimpleName() + ") while pre-close window(s) of " + this + ": " + t.getMessage());
}
}
}
}
super.preClose();
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
@Override
protected void preClose() {
if (!isEofSent()) {
log.debug("close({}) prevent sending EOF", this);
}
try {
signalChannelClosed(null);
} finally {
// clear the listeners since we are closing the channel (quicker GC)
this.channelListeners.clear();
// clear the attributes since we close the channel
clearAttributes();
}
IOException err = IoUtils.closeQuietly(getLocalWindow(), getRemoteWindow());
if (err != null) {
if (log.isDebugEnabled()) {
log.debug("Failed (" + err.getClass().getSimpleName() + ") to pre-close window(s) of " + this + ": " + err.getMessage());
}
if (log.isTraceEnabled()) {
Throwable[] suppressed = err.getSuppressed();
if (GenericUtils.length(suppressed) > 0) {
for (Throwable t : suppressed) {
log.trace("Suppressed " + t.getClass().getSimpleName() + ") while pre-close window(s) of " + this + ": " + t.getMessage());
}
}
}
}
super.preClose();
}
内容来源于网络,如有侵权,请联系作者删除!