paxxie2 commented on code in PR #15356:
URL: https://github.com/apache/dubbo/pull/15356#discussion_r2080021139
##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java:
##########
@@ -47,11 +47,8 @@ public byte[] compress(byte[] payloadByteArr) throws
RpcException {
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
- BZip2CompressorOutputStream cos;
- try {
- cos = new BZip2CompressorOutputStream(out);
+ try (BZip2CompressorOutputStream cos = new
BZip2CompressorOutputStream(out)) {
Review Comment:
commons-io ByteArrayOutputStream directly operates on memory, not network
IO, and does not manipulate file handles, it's close() method is also an empty
implementation, and it is not necessary to closećJust like a regular Java
object.
org.apache.commons.io.output.ByteArrayOutputStream#close:
```
public void close() throws IOException {
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]