Skip to content

Apache Lucene open-source search software

SOLR-8303: CustomBufferedIndexInput now includes resource description when throwing EOFException

Uwe Schindler8f7764a1baef
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f314eade1d8..1547379ec19 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -548,6 +548,9 @@ Other Changes
* SOLR-8302: SolrResourceLoader now takes a Path as its instance directory (Alan
Woodward, Shawn Heisey)
+* SOLR-8303: CustomBufferedIndexInput now includes resource description when
+ throwing EOFException. (Mike Drob via Uwe Schindler)
+
================== 5.3.1 ==================
Bug Fixes
diff --git a/solr/core/src/java/org/apache/solr/store/blockcache/CustomBufferedIndexInput.java b/solr/core/src/java/org/apache/solr/store/blockcache/CustomBufferedIndexInput.java
index e21077adccc..bcefff83a49 100644
--- a/solr/core/src/java/org/apache/solr/store/blockcache/CustomBufferedIndexInput.java
+++ b/solr/core/src/java/org/apache/solr/store/blockcache/CustomBufferedIndexInput.java
@@ -95,7 +95,7 @@ public abstract class CustomBufferedIndexInput extends IndexInput {
if (bufferLength < len) {
// Throw an exception when refill() could not read len bytes:
System.arraycopy(buffer, 0, b, offset, bufferLength);
- throw new IOException("read past EOF");
+ throw new EOFException("read past EOF: " + this);
} else {
System.arraycopy(buffer, 0, b, offset, len);
bufferPosition = len;
@@ -109,7 +109,7 @@ public abstract class CustomBufferedIndexInput extends IndexInput {
// here, because there's no need to reread what we
// had in the buffer.
long after = bufferStart + bufferPosition + len;
- if (after > length()) throw new IOException("read past EOF");
+ if (after > length()) throw new EOFException("read past EOF: " + this);
readInternal(b, offset, len);
bufferStart = after;
bufferPosition = 0;
@@ -183,7 +183,7 @@ public abstract class CustomBufferedIndexInput extends IndexInput {
if (end > length()) // don't read past EOF
end = length();
int newLength = (int) (end - start);
- if (newLength <= 0) throw new EOFException("read past EOF");
+ if (newLength <= 0) throw new EOFException("read past EOF: " + this);
if (buffer == null) {
buffer = store.takeBuffer(bufferSize);