This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 6bf1378ae8f1b6b1c558b5a6768c2805eba94d27
Author: Thomas Vandahl <t...@apache.org>
AuthorDate: Sun Mar 28 18:51:24 2021 +0200

    Be consistent in the use of channels
---
 .../commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java       | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
 
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
index 97873ce..0669b96 100644
--- 
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
+++ 
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/block/BlockDiskKeyStore.java
@@ -26,7 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.nio.ByteBuffer;
-import java.nio.channels.SeekableByteChannel;
+import java.nio.channels.FileChannel;
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
 import java.util.HashMap;
@@ -402,8 +402,7 @@ public class BlockDiskKeyStore<K>
             // Check file type
             int fileSignature = 0;
 
-            try (SeekableByteChannel bc = 
Files.newByteChannel(keyFile.toPath(),
-                    StandardOpenOption.READ))
+            try (FileChannel bc = FileChannel.open(keyFile.toPath(), 
StandardOpenOption.READ))
             {
                 final ByteBuffer signature = ByteBuffer.allocate(4);
                 bc.read(signature);
@@ -522,7 +521,7 @@ public class BlockDiskKeyStore<K>
 
         synchronized (keyFile)
         {
-            try (SeekableByteChannel bc = 
Files.newByteChannel(keyFile.toPath(),
+            try (FileChannel bc = FileChannel.open(keyFile.toPath(),
                     StandardOpenOption.CREATE,
                     StandardOpenOption.WRITE,
                     StandardOpenOption.TRUNCATE_EXISTING))

Reply via email to