You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2017/09/08 10:00:49 UTC
[06/10] lucene-solr:jira/solr-10990: SOLR-11314: FastCharStream:
re-use the READ_PAST_EOF exception
SOLR-11314: FastCharStream: re-use the READ_PAST_EOF exception
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/89feb150
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/89feb150
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/89feb150
Branch: refs/heads/jira/solr-10990
Commit: 89feb1500848d8d566d63be21d351d27a1bdcf6f
Parents: ce29124
Author: David Smiley <ds...@apache.org>
Authored: Thu Sep 7 21:12:45 2017 -0400
Committer: David Smiley <ds...@apache.org>
Committed: Thu Sep 7 21:12:45 2017 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
solr/core/src/java/org/apache/solr/parser/FastCharStream.java | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/89feb150/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index be89fb1..f652fb2 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -139,6 +139,8 @@ Optimizations
* SOLR-11242: QueryParser: re-use the LookaheadSuccess exception. (Michael Braun via David Smiley)
+* SOLR-11314: FastCharStream: re-use the READ_PAST_EOF exception. (Michael Braun via David Smiley)
+
Other Changes
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/89feb150/solr/core/src/java/org/apache/solr/parser/FastCharStream.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/parser/FastCharStream.java b/solr/core/src/java/org/apache/solr/parser/FastCharStream.java
index 7039c0a..b9cb27a 100644
--- a/solr/core/src/java/org/apache/solr/parser/FastCharStream.java
+++ b/solr/core/src/java/org/apache/solr/parser/FastCharStream.java
@@ -69,7 +69,7 @@ public final class FastCharStream implements CharStream {
int charsRead = // fill space in buffer
input.read(buffer, newPosition, buffer.length-newPosition);
if (charsRead == -1)
- throw new IOException("read past eof");
+ throw READ_PAST_EOF;
else
bufferLength += charsRead;
}
@@ -80,6 +80,11 @@ public final class FastCharStream implements CharStream {
return readChar();
}
+ /**
+ * This Exception is used as a signal rather than an exceptional state.
+ */
+ private static final IOException READ_PAST_EOF = new IOException("read past eof");
+
@Override
public final void backup(int amount) {
bufferPosition -= amount;