From 4177deccf1e91483f54c5fcfacffce0ce525ad39 Mon Sep 17 00:00:00 2001 From: AsamK Date: Fri, 5 Jun 2020 12:14:04 +0200 Subject: [PATCH] Ignore closed channel exception when closing the channel lock --- src/main/java/org/asamk/signal/storage/SignalAccount.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/asamk/signal/storage/SignalAccount.java b/src/main/java/org/asamk/signal/storage/SignalAccount.java index 94935441..d0638e41 100644 --- a/src/main/java/org/asamk/signal/storage/SignalAccount.java +++ b/src/main/java/org/asamk/signal/storage/SignalAccount.java @@ -38,6 +38,7 @@ import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.Channels; +import java.nio.channels.ClosedChannelException; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.util.Collection; @@ -429,7 +430,10 @@ public class SignalAccount implements Closeable { @Override public void close() throws IOException { synchronized (fileChannel) { - lock.close(); + try { + lock.close(); + } catch (ClosedChannelException ignored) { + } fileChannel.close(); } }