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 5a696379b1 fix: close PEM writer before reading output
5a696379b1 is described below

commit 5a696379b1aa06ed313d058977d4407b818ad67e
Author: heliang666s <[email protected]>
AuthorDate: Tue Jan 27 14:54:08 2026 +0800

    fix: close PEM writer before reading output
---
 .../main/java/org/apache/dubbo/security/cert/DubboCertManager.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/dubbo-plugin/dubbo-security/src/main/java/org/apache/dubbo/security/cert/DubboCertManager.java
 
b/dubbo-plugin/dubbo-security/src/main/java/org/apache/dubbo/security/cert/DubboCertManager.java
index 8bae66574a..49b33e9b1e 100644
--- 
a/dubbo-plugin/dubbo-security/src/main/java/org/apache/dubbo/security/cert/DubboCertManager.java
+++ 
b/dubbo-plugin/dubbo-security/src/main/java/org/apache/dubbo/security/cert/DubboCertManager.java
@@ -367,11 +367,11 @@ public class DubboCertManager {
      */
     private String generatePemKey(String type, byte[] content) throws 
IOException {
         PemObject pemObject = new PemObject(type, content);
-        try (StringWriter str = new StringWriter();
-                JcaPEMWriter jcaPEMWriter = new JcaPEMWriter(str)) {
+        StringWriter str = new StringWriter();
+        try (JcaPEMWriter jcaPEMWriter = new JcaPEMWriter(str)) {
             jcaPEMWriter.writeObject(pemObject);
-            return str.toString();
         }
+        return str.toString();
     }
 
     /**

Reply via email to