Merge pull request #788 from diffblue-assistant/finallyclosetotrywithresources
Use try-with-resources
This commit is contained in:
commit
74f3799eb4
@ -37,11 +37,8 @@ public class SimpleFileWriter {
|
||||
* Constructor
|
||||
*/
|
||||
public SimpleFileWriter(String filename, FileWriterAction action) throws IOException {
|
||||
FileWriter writer = new FileWriter(filename);
|
||||
try {
|
||||
try (FileWriter writer = new FileWriter(filename)) {
|
||||
action.writeFile(writer);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user