RainYuY commented on code in PR #15874:
URL: https://github.com/apache/dubbo/pull/15874#discussion_r2621521433


##########
dubbo-common/src/main/java/org/apache/dubbo/common/io/Bytes.java:
##########
@@ -786,12 +785,8 @@ public static byte[] base642bytes(final String str, final 
int off, final int len
      */
     public static byte[] zip(byte[] bytes) throws IOException {
         UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
-        OutputStream os = new DeflaterOutputStream(bos);
-        try {
+        try (DeflaterOutputStream os = new DeflaterOutputStream(bos)) {
             os.write(bytes);
-        } finally {
-            os.close();
-            bos.close();

Review Comment:
   BOS need close too.



-- 
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]

Reply via email to