Alonexc commented on code in PR #4274:
URL: https://github.com/apache/eventmesh/pull/4274#discussion_r1274260377


##########
eventmesh-common/src/test/java/org/apache/eventmesh/common/file/WatchFileManagerTest.java:
##########
@@ -50,11 +57,16 @@ public boolean support(FileChangeContext changeContext) {
         };
         WatchFileManager.registerFileChangeListener(f.getParent(), 
fileChangeListener);
 
-        Properties properties = new Properties();
-        properties.load(new BufferedReader(new FileReader(file)));
-        properties.setProperty("eventMesh.server.newAdd", "newAdd");
-        FileWriter fw = new FileWriter(file);
-        properties.store(fw, "newAdd");
+        try (final BufferedReader reader = new BufferedReader(new 
FileReader(file));
+            final FileWriter fw = new FileWriter(file)) {
+            Properties properties = new Properties();
+            properties.load(reader);
+            properties.setProperty("eventMesh.server.newAdd", "newAdd");
+            properties.store(fw, "newAdd");
+        }
+        catch (IOException e) {

Review Comment:
   Using try-with-resources will automatically manage resources without catch 
catching exceptions.



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