aboutsummaryrefslogtreecommitdiff
path: root/src/website
diff options
context:
space:
mode:
Diffstat (limited to 'src/website')
-rw-r--r--src/website/lombok/website/FetchCurrentVersion.java12
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();
}