From 7a1e4d28aaf04fbd919efb86dd481a9900f569fb Mon Sep 17 00:00:00 2001 From: Louis Shawn Date: Tue, 3 Mar 2026 15:47:42 +0800 Subject: [PATCH] fix(common): close input stream when loading single properties file --- .../java/org/apache/dubbo/common/utils/ConfigUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java index 796b98965ef..1dd727ec61d 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java @@ -257,8 +257,10 @@ public static Properties loadProperties( } // fall back to use method getResourceAsStream - try { - properties.load(ClassUtils.getClassLoader().getResourceAsStream(fileName)); + try (InputStream input = ClassUtils.getClassLoader().getResourceAsStream(fileName)) { + if (input != null) { + properties.load(input); + } } catch (Throwable e) { logger.warn( COMMON_IO_EXCEPTION,