From 851f73481addc65999d0f25d2dd845d2aad05f2a Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Mon, 11 Apr 2022 12:42:01 +0200 Subject: [PATCH] Bugfixes --- .gitignore | 2 ++ pom.xml | 13 +++++++++++++ .../dbengine/lucene/DirectNIOFSDirectory.java | 17 ++++++++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d7e66fe..3dc1db5 100644 --- a/.gitignore +++ b/.gitignore @@ -181,3 +181,5 @@ fabric.properties dbengine.iml /.idea/ + +.ci-friendly-pom.xml diff --git a/pom.xml b/pom.xml index 9f804a1..d9ff998 100644 --- a/pom.xml +++ b/pom.xml @@ -614,6 +614,19 @@ + + com.outbrain.swinfra + ci-friendly-flatten-maven-plugin + 1.0.14 + + + + clean + flatten + + + + diff --git a/src/main/java/it/cavallium/dbengine/lucene/DirectNIOFSDirectory.java b/src/main/java/it/cavallium/dbengine/lucene/DirectNIOFSDirectory.java index 89f213c..2e707eb 100644 --- a/src/main/java/it/cavallium/dbengine/lucene/DirectNIOFSDirectory.java +++ b/src/main/java/it/cavallium/dbengine/lucene/DirectNIOFSDirectory.java @@ -4,6 +4,12 @@ import static it.cavallium.dbengine.lucene.LuceneUtils.alignUnsigned; import static it.cavallium.dbengine.lucene.LuceneUtils.readInternalAligned; import com.sun.nio.file.ExtendedOpenOption; +import java.nio.file.OpenOption; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import org.apache.lucene.store.FSDirectory; +import org.apache.lucene.store.LockFactory; + import java.io.Closeable; import java.io.EOFException; import java.io.IOException; @@ -23,7 +29,8 @@ import org.apache.lucene.util.IOUtils; @SuppressWarnings({"RedundantArrayCreation", "unused", "unused", "RedundantCast"}) public class DirectNIOFSDirectory extends FSDirectory { - private final OpenOption[] openOptions = {StandardOpenOption.READ, ExtendedOpenOption.DIRECT}; + @SuppressWarnings("sunapi") + private final OpenOption[] openOptions = {StandardOpenOption.READ, com.sun.nio.file.ExtendedOpenOption.DIRECT}; public DirectNIOFSDirectory(Path path, LockFactory lockFactory) throws IOException { super(path, lockFactory); @@ -58,10 +65,10 @@ public class DirectNIOFSDirectory extends FSDirectory { static final class NIOFSIndexInput extends BufferedIndexInput { private static final int CHUNK_SIZE = 16384; - protected final FileChannel channel; + private final FileChannel channel; boolean isClone = false; - protected final long off; - protected final long end; + private final long off; + private final long end; public NIOFSIndexInput(String resourceDesc, FileChannel fc, IOContext context) throws IOException { super(resourceDesc, context); @@ -99,7 +106,7 @@ public class DirectNIOFSDirectory extends FSDirectory { } } - public final long length() { + public long length() { return this.end - this.off; }