You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/02/10 17:27:34 UTC
[6/9] lucene-solr git commit: LUCENE-6932: improve exception messages;
rename length parameter to sliceLength, and return it as the length, for
clarity
LUCENE-6932: improve exception messages; rename length parameter to sliceLength, and return it as the length, for clarity
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3100f1b1
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3100f1b1
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3100f1b1
Branch: refs/heads/branch_5_4
Commit: 3100f1b187ffaeee35dfbad1d26b5c44e5e4c1f7
Parents: 2512ab6
Author: Michael McCandless <ma...@mikemccandless.com>
Authored: Sun Jan 24 06:25:45 2016 -0500
Committer: Mike McCandless <mi...@apache.org>
Committed: Wed Feb 10 10:47:18 2016 -0500
----------------------------------------------------------------------
.../java/org/apache/lucene/store/RAMInputStream.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3100f1b1/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java b/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
index 3e86a60..193a088 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
@@ -104,16 +104,16 @@ public class RAMInputStream extends IndexInput implements Cloneable {
bufferPosition = (int) (pos % BUFFER_SIZE);
// This is not >= because seeking to exact end of file is OK: this is where
- // you'd also be if you did a readBytes of all bytes in the file)
+ // you'd also be if you did a readBytes of all bytes in the file
if (getFilePointer() > length()) {
- throw new EOFException("read past EOF: pos=" + getFilePointer() + " vs length=" + length() + ": " + this);
+ throw new EOFException("seek beyond EOF: pos=" + getFilePointer() + " vs length=" + length() + ": " + this);
}
}
private void nextBuffer() throws IOException {
// This is >= because we are called when there is at least 1 more byte to read:
if (getFilePointer() >= length()) {
- throw new EOFException("read past EOF: pos=" + getFilePointer() + " vs length=" + length() + ": " + this);
+ throw new EOFException("cannot read another byte at EOF: pos=" + getFilePointer() + " vs length=" + length() + ": " + this);
}
currentBufferIndex++;
setCurrentBuffer();
@@ -133,11 +133,11 @@ public class RAMInputStream extends IndexInput implements Cloneable {
}
@Override
- public IndexInput slice(String sliceDescription, final long offset, final long length) throws IOException {
- if (offset < 0 || length < 0 || offset + length > this.length) {
+ public IndexInput slice(String sliceDescription, final long offset, final long sliceLength) throws IOException {
+ if (offset < 0 || sliceLength < 0 || offset + sliceLength > this.length) {
throw new IllegalArgumentException("slice() " + sliceDescription + " out of bounds: " + this);
}
- return new RAMInputStream(getFullSliceDescription(sliceDescription), file, offset + length) {
+ return new RAMInputStream(getFullSliceDescription(sliceDescription), file, offset + sliceLength) {
{
seek(0L);
}
@@ -157,7 +157,7 @@ public class RAMInputStream extends IndexInput implements Cloneable {
@Override
public long length() {
- return super.length() - offset;
+ return sliceLength;
}
@Override