This is an automated email from the ASF dual-hosted git repository.

RocMarshal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 6922e172dff [hotfix][core] Use the try mechanism to proactively close 
closeable objects to avoid object leaks in ExceptionUtils#stringifyException 
(#29490)
6922e172dff is described below

commit 6922e172dffecea4473eee8aef78a0a760c7f409
Author: Yuepeng Pan <[email protected]>
AuthorDate: Fri Oct 16 13:02:03 2026 +0800

    [hotfix][core] Use the try mechanism to proactively close closeable objects 
to avoid object leaks in ExceptionUtils#stringifyException (#29490)
---
 flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java 
b/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
index 96443d19e7f..c9b02b8216a 100644
--- a/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
+++ b/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
@@ -67,11 +67,9 @@ public final class ExceptionUtils {
             return STRINGIFIED_NULL_EXCEPTION;
         }
 
-        try {
-            StringWriter stm = new StringWriter();
-            PrintWriter wrt = new PrintWriter(stm);
+        try (StringWriter stm = new StringWriter();
+                PrintWriter wrt = new PrintWriter(stm)) {
             e.printStackTrace(wrt);
-            wrt.close();
             return stm.toString();
         } catch (Throwable t) {
             return e.getClass().getName() + " (error while printing stack 
trace)";

Reply via email to