This is an automated email from the ASF dual-hosted git repository. heliang666s pushed a commit to branch fix-resource-leaks in repository https://gitbox.apache.org/repos/asf/dubbo.git
commit 936ea58bf9019d73c522339251d51d994b69a42b Author: heliang666s <[email protected]> AuthorDate: Sun Jan 25 19:15:39 2026 +0800 fix: include bzip2 output stream in try-with-resources --- .../java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java index 32971f0bf3..809ade5a6d 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java @@ -57,13 +57,13 @@ public class Bzip2 implements Compressor, DeCompressor { return new byte[0]; } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try (BZip2CompressorOutputStream cos = new BZip2CompressorOutputStream(out)) { + try (ByteArrayOutputStream out = new ByteArrayOutputStream(); + BZip2CompressorOutputStream cos = new BZip2CompressorOutputStream(out)) { cos.write(payloadByteArr); + return out.toByteArray(); } catch (Exception e) { throw new IllegalStateException(e); } - return out.toByteArray(); } @Override
