Skip to content

Apache Lucene open-source search software

LUCENE-3539: include resource in a few more cases

Michael McCandlessc0c36d00d638
diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java b/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
index 151c8bfe066..ebfc60b2d03 100644
--- a/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
+++ b/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
@@ -97,7 +97,7 @@ public class WindowsDirectory extends FSDirectory {
}
if (bytesRead != length) {
- throw new EOFException("Read past EOF: " + this);
+ throw new EOFException("Read past EOF (resource: " + this + ")");
}
}
diff --git a/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java b/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java
index 0e8ffda36c4..7ba01e9ae33 100644
--- a/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java
+++ b/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java
@@ -18,6 +18,7 @@ package org.apache.lucene.store;
*/
import java.io.File;
+import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException; // javadoc @link
@@ -181,7 +182,7 @@ public class NIOFSDirectory extends FSDirectory {
long pos = getFilePointer() + off;
if (pos + len > end) {
- throw new IOException("read past EOF: " + this);
+ throw new EOFException("read past EOF (resource: " + this + ")");
}
try {
diff --git a/lucene/src/java/org/apache/lucene/store/RAMInputStream.java b/lucene/src/java/org/apache/lucene/store/RAMInputStream.java
index d58ff725a90..44725b17555 100644
--- a/lucene/src/java/org/apache/lucene/store/RAMInputStream.java
+++ b/lucene/src/java/org/apache/lucene/store/RAMInputStream.java
@@ -91,7 +91,7 @@ public class RAMInputStream extends IndexInput implements Cloneable {
if (currentBufferIndex >= file.numBuffers()) {
// end of file reached, no more buffers left
if (enforceEOF) {
- throw new EOFException("Read past EOF: " + this);
+ throw new EOFException("Read past EOF (resource: " + this + ")");
} else {
// Force EOF if a read takes place at this position
currentBufferIndex--;