Committed by
Gerrit Code Review
Fix resource leak warning.
Change-Id: I7aa926d8a62220a902e983b4b692abecd8f687e1
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -301,10 +301,10 @@ public abstract class Tools { | ... | @@ -301,10 +301,10 @@ public abstract class Tools { |
301 | * @return file contents | 301 | * @return file contents |
302 | */ | 302 | */ |
303 | public static List<String> slurp(File path) { | 303 | public static List<String> slurp(File path) { |
304 | - try { | 304 | + try ( |
305 | BufferedReader br = new BufferedReader( | 305 | BufferedReader br = new BufferedReader( |
306 | new InputStreamReader(new FileInputStream(path), StandardCharsets.UTF_8)); | 306 | new InputStreamReader(new FileInputStream(path), StandardCharsets.UTF_8)); |
307 | - | 307 | + ) { |
308 | List<String> lines = new ArrayList<>(); | 308 | List<String> lines = new ArrayList<>(); |
309 | String line; | 309 | String line; |
310 | while ((line = br.readLine()) != null) { | 310 | while ((line = br.readLine()) != null) { | ... | ... |
-
Please register or login to post a comment