From 1de15fbcfa9a5f0d0e24d881e881cff30b7e6851 Mon Sep 17 00:00:00 2001 From: Nick Mancuso Date: Sat, 9 Jul 2022 20:46:27 -0400 Subject: [PATCH] Issue #614: Suppress all Idea Inspection violations --- .../checkstyle/publishers/SourceforgeRssPublisher.java | 8 +++++--- .../github/checkstyle/templates/TemplateProcessor.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) 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 1ecb75367..6bd829351 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 0459a01f6..e3af59acb 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 {