Alonexc commented on code in PR #3320:
URL: 
https://github.com/apache/incubator-eventmesh/pull/3320#discussion_r1123967910


##########
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:
   Here you can also change to use try-with-resources, as well as specify the 
character set.
   I have a suggestion, how about you look at:
   
![image](https://user-images.githubusercontent.com/91315508/222616612-1f3ce3ba-804b-4827-a451-557188592f83.png)
   



-- 
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