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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1715402 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2015-11-20 18:55:55 +00:00
parent cae3ddd5c7
commit 8f7764a1ba
2 changed files with 6 additions and 3 deletions

View File

@ -548,6 +548,9 @@ Other Changes
* SOLR-8302: SolrResourceLoader now takes a Path as its instance directory (Alan * SOLR-8302: SolrResourceLoader now takes a Path as its instance directory (Alan
Woodward, Shawn Heisey) Woodward, Shawn Heisey)
* SOLR-8303: CustomBufferedIndexInput now includes resource description when
throwing EOFException. (Mike Drob via Uwe Schindler)
================== 5.3.1 ================== ================== 5.3.1 ==================
Bug Fixes Bug Fixes

View File

@ -95,7 +95,7 @@ public abstract class CustomBufferedIndexInput extends IndexInput {
if (bufferLength < len) { if (bufferLength < len) {
// Throw an exception when refill() could not read len bytes: // Throw an exception when refill() could not read len bytes:
System.arraycopy(buffer, 0, b, offset, bufferLength); System.arraycopy(buffer, 0, b, offset, bufferLength);
throw new IOException("read past EOF"); throw new EOFException("read past EOF: " + this);
} else { } else {
System.arraycopy(buffer, 0, b, offset, len); System.arraycopy(buffer, 0, b, offset, len);
bufferPosition = len; bufferPosition = len;
@ -109,7 +109,7 @@ public abstract class CustomBufferedIndexInput extends IndexInput {
// here, because there's no need to reread what we // here, because there's no need to reread what we
// had in the buffer. // had in the buffer.
long after = bufferStart + bufferPosition + len; 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); readInternal(b, offset, len);
bufferStart = after; bufferStart = after;
bufferPosition = 0; bufferPosition = 0;
@ -183,7 +183,7 @@ public abstract class CustomBufferedIndexInput extends IndexInput {
if (end > length()) // don't read past EOF if (end > length()) // don't read past EOF
end = length(); end = length();
int newLength = (int) (end - start); 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) { if (buffer == null) {
buffer = store.takeBuffer(bufferSize); buffer = store.takeBuffer(bufferSize);