This commit is contained in:
Looly
2023-03-27 02:02:10 +08:00
parent 16f7549c7d
commit 4fca8310e7
96 changed files with 307 additions and 315 deletions

View File

@@ -50,7 +50,7 @@ public interface HttpBody {
try {
write(out);
} finally {
IoUtil.close(out);
IoUtil.closeQuietly(out);
}
}

View File

@@ -127,7 +127,7 @@ public class MultipartOutputStream extends OutputStream {
@Override
public void close() {
finish();
IoUtil.close(this.out);
IoUtil.closeQuietly(this.out);
}
/**

View File

@@ -106,7 +106,7 @@ public class ResponseBody implements HttpBody, Closeable {
return this.bodyStream.copyTo(out, streamProgress);
} finally {
if (isCloseOut) {
IoUtil.close(out);
IoUtil.closeQuietly(out);
}
}
}

View File

@@ -48,7 +48,7 @@ public class HttpClient4Engine implements ClientEngine {
public HttpClient4Engine setConfig(final ClientConfig config) {
this.config = config;
// 重置客户端
IoUtil.close(this.engine);
IoUtil.closeQuietly(this.engine);
this.engine = null;
return this;
}

View File

@@ -53,7 +53,7 @@ public class HttpClient5Engine implements ClientEngine {
public HttpClient5Engine setConfig(final ClientConfig config) {
this.config = config;
// 重置客户端
IoUtil.close(this.engine);
IoUtil.closeQuietly(this.engine);
this.engine = null;
return this;
}

View File

@@ -66,7 +66,7 @@ public class JdkClientEngine implements ClientEngine {
doSend(message);
} catch (final IOException e) {
// 出错后关闭连接
IoUtil.close(this);
IoUtil.closeQuietly(this);
throw new RuntimeException(e);
}
@@ -110,7 +110,7 @@ public class JdkClientEngine implements ClientEngine {
*/
private void initConn(final Request message) {
// 执行下次请求时自动关闭上次请求(常用于转发)
IoUtil.close(this);
IoUtil.closeQuietly(this);
this.conn = buildConn(message);
}

View File

@@ -202,7 +202,7 @@ public class JdkHttpResponse implements Response, Closeable {
@Override
public void close() {
// 关闭流
IoUtil.close(this.body);
IoUtil.closeQuietly(this.body);
// 关闭连接
this.httpConnection.disconnectQuietly();
}

View File

@@ -351,8 +351,8 @@ public class HttpServerResponse extends HttpServerBase {
out = this.httpExchange.getResponseBody();
IoUtil.copy(in, out);
} finally {
IoUtil.close(out);
IoUtil.close(in);
IoUtil.closeQuietly(out);
IoUtil.closeQuietly(in);
}
return this;
}
@@ -391,7 +391,7 @@ public class HttpServerResponse extends HttpServerBase {
in = FileUtil.getInputStream(file);
write(in, (int)fileSize, contentType, fileName);
} finally {
IoUtil.close(in);
IoUtil.closeQuietly(in);
}
return this;
}

View File

@@ -540,7 +540,7 @@ public class SoapClient implements HeaderOperation<SoapClient> {
} catch (final IOException | SOAPException e) {
throw new SoapRuntimeException(e);
} finally {
IoUtil.close(res);
IoUtil.closeQuietly(res);
}
}

View File

@@ -25,6 +25,6 @@ public class Issue2901Test {
.send();
Console.log(res.bodyStr());
IoUtil.close(res);
IoUtil.closeQuietly(res);
}
}