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,