You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/10 10:03:49 UTC

[lucene] 12/18: LUCENE-6932: also fix NIOFSIndexInput to throw EOFE if you seek beyond end of file

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

dweiss pushed a commit to branch branch_5_4
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit b4fa82b0772718d84db3d177f8ce7450be3c51ac
Author: Michael McCandless <mi...@apache.org>
AuthorDate: Fri Jan 22 15:21:20 2016 +0000

    LUCENE-6932: also fix NIOFSIndexInput to throw EOFE if you seek beyond end of file
    
    git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/branch_5x@1726231 13f79535-47bb-0310-9956-ffa450edef68
---
 lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java
index 84f1a7f..b739290 100644
--- a/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java
@@ -192,6 +192,10 @@ public class NIOFSDirectory extends FSDirectory {
     }
 
     @Override
-    protected void seekInternal(long pos) throws IOException {}
+    protected void seekInternal(long pos) throws IOException {
+      if (pos > length()) {
+        throw new EOFException("read past EOF: pos=" + pos + " vs length=" + length() + ": " + this);
+      }
+    }
   }
 }