diff options
author | Roel Spilker <r.spilker@gmail.com> | 2020-01-16 00:13:44 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-01-20 13:55:43 +0100 |
commit | 18d70e7bc677cc1bd2e7c14f917543d88ac26ac9 (patch) | |
tree | 0edd0e384125070b7a4b4886888537596300fd18 /src/website/lombok | |
parent | 7ca43108f52e0d4432f0266db5897eef919c71cf (diff) | |
download | lombok-18d70e7bc677cc1bd2e7c14f917543d88ac26ac9.tar.gz lombok-18d70e7bc677cc1bd2e7c14f917543d88ac26ac9.tar.bz2 lombok-18d70e7bc677cc1bd2e7c14f917543d88ac26ac9.zip |
Close more inputstreams
Diffstat (limited to 'src/website/lombok')
-rw-r--r-- | src/website/lombok/website/FetchCurrentVersion.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/website/lombok/website/FetchCurrentVersion.java b/src/website/lombok/website/FetchCurrentVersion.java index 0d789256..d32c45dd 100644 --- a/src/website/lombok/website/FetchCurrentVersion.java +++ b/src/website/lombok/website/FetchCurrentVersion.java @@ -21,11 +21,15 @@ public class FetchCurrentVersion { InputStream in = new URL("https://projectlombok.org/download").openStream(); try { BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8")); - for (String line = br.readLine(); line != null; line = br.readLine()) { - Matcher m = VERSION_PATTERN.matcher(line); - if (m.matches() && m.group(1).equals("currentVersionFull") == fetchFull) return m.group(2).replace(""", "\""); + try { + for (String line = br.readLine(); line != null; line = br.readLine()) { + Matcher m = VERSION_PATTERN.matcher(line); + if (m.matches() && m.group(1).equals("currentVersionFull") == fetchFull) return m.group(2).replace(""", "\""); + } + throw new IOException("Expected a span with id 'currentVersion'"); + } finally { + br.close(); } - throw new IOException("Expected a span with id 'currentVersion'"); } finally { in.close(); } |