diff --git a/releasenotes-builder/src/main/java/com/github/checkstyle/publishers/SourceforgeRssPublisher.java b/releasenotes-builder/src/main/java/com/github/checkstyle/publishers/SourceforgeRssPublisher.java index 1ecb7536..6bd82935 100644 --- a/releasenotes-builder/src/main/java/com/github/checkstyle/publishers/SourceforgeRssPublisher.java +++ b/releasenotes-builder/src/main/java/com/github/checkstyle/publishers/SourceforgeRssPublisher.java @@ -108,9 +108,11 @@ public void publish() throws IOException { */ private static int getPostsCount() throws IOException { final HttpURLConnection conn = (HttpURLConnection) new URL(POST_URL).openConnection(); - final BufferedReader br = new BufferedReader( - new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); - final Matcher matcher = NUMBER_PATTERN.matcher(br.readLine()); + final Matcher matcher; + try (BufferedReader br = new BufferedReader( + new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) { + matcher = NUMBER_PATTERN.matcher(br.readLine()); + } int count = -1; if (matcher.find()) { count = Integer.parseInt(matcher.group()); diff --git a/releasenotes-builder/src/main/java/com/github/checkstyle/templates/TemplateProcessor.java b/releasenotes-builder/src/main/java/com/github/checkstyle/templates/TemplateProcessor.java index 0459a01f..e3af59ac 100644 --- a/releasenotes-builder/src/main/java/com/github/checkstyle/templates/TemplateProcessor.java +++ b/releasenotes-builder/src/main/java/com/github/checkstyle/templates/TemplateProcessor.java @@ -99,6 +99,7 @@ public static void generateWithFreemarker(Map variables, String * @return The contents of the template. * @throws FileNotFoundException if the supplied file can't be found. * @throws IllegalStateException if the resource can't be found. + * @noinspection IOStreamConstructor */ private static String loadTemplate(String fileName, String defaultResource) throws FileNotFoundException {