sanskar-thakur commented on code in PR #3320:
URL: 
https://github.com/apache/incubator-eventmesh/pull/3320#discussion_r1133122299


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java:
##########
@@ -68,9 +72,28 @@ class PropertiesFileLoad implements FileLoad {
         public <T> T getConfig(ConfigInfo configInfo) throws IOException {
             final Properties properties = new Properties();
             if (StringUtils.isNotBlank(configInfo.getResourceUrl())) {
-                properties.load(new BufferedReader(new 
InputStreamReader(getClass().getResourceAsStream(configInfo.getResourceUrl()))));
+                try (InputStreamReader reader = new InputStreamReader(
+                    
Objects.requireNonNull(getClass().getResourceAsStream(configInfo.getResourceUrl())),
 Constants.DEFAULT_CHARSET)) {
+                    properties.load(new BufferedReader(reader));
+                }
             } else {
-                properties.load(new BufferedReader(new 
FileReader(configInfo.getFilePath())));
+                FileReader reader = null;
+                try {

Review Comment:
   Agreed. Updated this code block with try-with-resources.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to