You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/07/07 09:33:35 UTC

[incubator-eventmesh] branch master updated: [ISSUE #987] try-with-resource to close the BufferedReader (#987)

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

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 63255c06 [ISSUE #987] try-with-resource to close the BufferedReader (#987)
     new edc4659a Merge pull request #994 from wuyiliang1/fix_patch_close_resource
63255c06 is described below

commit 63255c06bb5932b7b86db09fd58c507d130d2974
Author: wuyiliang <wu...@huawei.com>
AuthorDate: Wed Jul 6 12:07:21 2022 +0800

    [ISSUE #987] try-with-resource to close the BufferedReader (#987)
---
 .../java/org/apache/eventmesh/common/config/ConfigurationWrapper.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigurationWrapper.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigurationWrapper.java
index c2de3470..4457da24 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigurationWrapper.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigurationWrapper.java
@@ -80,9 +80,9 @@ public class ConfigurationWrapper {
     }
 
     private void load() {
-        try {
+        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
             logger.info("loading config: {}", file);
-            properties.load(new BufferedReader(new FileReader(file)));
+            properties.load(reader);
         } catch (IOException e) {
             logger.error("loading properties [{}] error", file, e);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org