From a3a167909925e29f863fd9ee1dbfd1544b6923ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Sat, 8 Oct 2016 00:19:04 +0200 Subject: [PATCH] fix: resource leak in template fast-debug code Change-Id: I570f997bb3e61d916ccc2dfd0ad23c8225ee9020 --- src/org/cacert/gigi/output/template/Template.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/org/cacert/gigi/output/template/Template.java b/src/org/cacert/gigi/output/template/Template.java index 21c2b04e..6aa9348a 100644 --- a/src/org/cacert/gigi/output/template/Template.java +++ b/src/org/cacert/gigi/output/template/Template.java @@ -236,9 +236,8 @@ public class Template implements Outputable { protected void tryReload() { if (source != null && lastLoaded < source.lastModified()) { - try { - System.out.println("Reloading template.... " + source); - InputStreamReader r = new InputStreamReader(new FileInputStream(source), "UTF-8"); + System.out.println("Reloading template.... " + source); + try (InputStreamReader r = new InputStreamReader(new FileInputStream(source), "UTF-8")) { data = parse(r).getBlock(null); r.close(); lastLoaded = source.lastModified() + 1000; -- 2.39.2