From 95b424b6e17d6e52bd101b057b580cd9bd2b4b06 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 22 Jan 2016 15:19:10 +0000 Subject: [PATCH] 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/trunk@1726229 13f79535-47bb-0310-9956-ffa450edef68 --- .../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 84f1a7ff899..b7392904fd1 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); + } + } } }