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


The following commit(s) were added to refs/heads/fix-resource-leaks by this 
push:
     new c06f633c9c fix: close bzip2 stream before reading output
c06f633c9c is described below

commit c06f633c9cfbeb7ea02b6720239986e1a6021937
Author: heliang666s <[email protected]>
AuthorDate: Tue Jan 27 12:06:22 2026 +0800

    fix: close bzip2 stream before reading output
---
 .../java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java   | 7 ++++---
 1 file changed, 4 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 809ade5a6d..44189f65a9 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,9 +57,10 @@ public class Bzip2 implements Compressor, DeCompressor {
             return new byte[0];
         }
 
-        try (ByteArrayOutputStream out = new ByteArrayOutputStream();
-                BZip2CompressorOutputStream cos = new 
BZip2CompressorOutputStream(out)) {
-            cos.write(payloadByteArr);
+        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
+            try (BZip2CompressorOutputStream cos = new 
BZip2CompressorOutputStream(out)) {
+                cos.write(payloadByteArr);
+            }
             return out.toByteArray();
         } catch (Exception e) {
             throw new IllegalStateException(e);

Reply via email to