]> nmode's Git Repositories - signal-cli/commitdiff
Ignore closed channel exception when closing the channel lock
authorAsamK <asamk@gmx.de>
Fri, 5 Jun 2020 10:14:04 +0000 (12:14 +0200)
committerAsamK <asamk@gmx.de>
Fri, 5 Jun 2020 10:14:04 +0000 (12:14 +0200)
src/main/java/org/asamk/signal/storage/SignalAccount.java

index 9493544162bff1df6678ef4d842509a5c541c638..d0638e410562169167d511c82f840a18b2fd8ac8 100644 (file)
@@ -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();
         }
     }