Merge "idegen: Migrate try-finally to try-with-resources for Configuration.java"

This commit is contained in:
Treehugger Robot
2022-10-03 04:50:00 +00:00
committed by Gerrit Code Review

View File

@@ -276,8 +276,7 @@ public class Configuration {
*/ */
public static void parseFile(File file, Collection<Pattern> patterns) public static void parseFile(File file, Collection<Pattern> patterns)
throws IOException { throws IOException {
BufferedReader in = new BufferedReader(new FileReader(file)); try (BufferedReader in = new BufferedReader(new FileReader(file))) {
try {
String line; String line;
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
String trimmed = line.trim(); String trimmed = line.trim();
@@ -285,8 +284,6 @@ public class Configuration {
patterns.add(Pattern.compile(trimmed)); patterns.add(Pattern.compile(trimmed));
} }
} }
} finally {
in.close();
} }
} }
} }