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:51 UTC

[lucene] 14/18: LUCENE-6932: also fix RAFIndexInput 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 2512ab6c1f3089cb8fe534532f0676c3358a5cd4
Author: Michael McCandless <mi...@apache.org>
AuthorDate: Fri Jan 22 19:00:47 2016 +0000

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

diff --git a/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java b/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java
index 9c3e9b0..94be104 100644
--- a/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java
+++ b/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java
@@ -165,7 +165,10 @@ public class RAFDirectory extends FSDirectory {
     }
   
     @Override
-    protected void seekInternal(long position) {
+    protected void seekInternal(long pos) throws IOException {
+      if (pos > length()) {
+        throw new EOFException("read past EOF: pos=" + pos + " vs length=" + length() + ": " + this);
+      }
     }
     
     boolean isFDValid() throws IOException {