From dfb581ef1217650c882ea78ba3d00e01de570bc7 Mon Sep 17 00:00:00 2001 From: akwizgran Date: Tue, 23 Oct 2018 14:29:26 +0100 Subject: [PATCH] Remove try-with-resources to appease Animal Sniffer. --- .../briar/logging/PersistentLogManagerImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/briar-core/src/main/java/org/briarproject/briar/logging/PersistentLogManagerImpl.java b/briar-core/src/main/java/org/briarproject/briar/logging/PersistentLogManagerImpl.java index 64c8816a0..d2b41780e 100644 --- a/briar-core/src/main/java/org/briarproject/briar/logging/PersistentLogManagerImpl.java +++ b/briar-core/src/main/java/org/briarproject/briar/logging/PersistentLogManagerImpl.java @@ -146,13 +146,17 @@ class PersistentLogManagerImpl implements PersistentLogManager, if (oldLogFile.exists()) { LOG.info("Reading old log file"); List lines = new ArrayList<>(); - try (InputStream in = new FileInputStream(oldLogFile)) { + InputStream in = new FileInputStream(oldLogFile); + //noinspection TryFinallyCanBeTryWithResources + try { InputStream reader = streamReaderFactory .createLogStreamReader(in, oldLogKey); Scanner s = new Scanner(reader); while (s.hasNextLine()) lines.add(s.nextLine()); s.close(); return lines; + } finally { + in.close(); } } else { LOG.info("Old log file does not exist");