diff --git a/pom.xml b/pom.xml index 28304b94..7e98973e 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 1.608 - 6 + 7 1.3 diff --git a/src/main/java/hudson/plugins/timestamper/annotator/ConsoleLogParserImpl.java b/src/main/java/hudson/plugins/timestamper/annotator/ConsoleLogParserImpl.java index eea8fadf..e4ed9f08 100644 --- a/src/main/java/hudson/plugins/timestamper/annotator/ConsoleLogParserImpl.java +++ b/src/main/java/hudson/plugins/timestamper/annotator/ConsoleLogParserImpl.java @@ -24,7 +24,6 @@ package hudson.plugins.timestamper.annotator; import hudson.model.Run; -import hudson.plugins.timestamper.io.Closeables; import java.io.BufferedInputStream; import java.io.IOException; @@ -34,7 +33,7 @@ /** * Implementation of ConsoleLogParser. - * + * * @author Steven G. Brown */ @Immutable @@ -46,7 +45,7 @@ class ConsoleLogParserImpl implements ConsoleLogParser { /** * Create a new {@link ConsoleLogParserImpl}. - * + * * @param pos * the position to find in the console log file. A non-negative * position is from the start of the file, and a negative position is @@ -63,8 +62,7 @@ class ConsoleLogParserImpl implements ConsoleLogParser { public ConsoleLogParser.Result seek(Run build) throws IOException { ConsoleLogParser.Result result = new ConsoleLogParser.Result(); result.atNewLine = true; - InputStream inputStream = new BufferedInputStream(build.getLogInputStream()); - try { + try (InputStream inputStream = new BufferedInputStream(build.getLogInputStream())) { long posFromStart = pos; if (pos < 0) { posFromStart = build.getLogText().length() + pos; @@ -80,8 +78,6 @@ public ConsoleLogParser.Result seek(Run build) throws IOException { result.lineNumber++; } } - } finally { - Closeables.closeQuietly(inputStream); } return result; }