Apache Lucene open-source search software
SOLR-11314: FastCharStream: re-use the READ_PAST_EOF exception
David Smiley89feb1500848
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex be89fb1880f..f652fb2d60d 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----------------------diff --git a/solr/core/src/java/org/apache/solr/parser/FastCharStream.java b/solr/core/src/java/org/apache/solr/parser/FastCharStream.javaindex 7039c0a582e..b9cb27abd9d 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 bufferinput.read(buffer, newPosition, buffer.length-newPosition);if (charsRead == -1)- throw new IOException("read past eof");+ throw READ_PAST_EOF;elsebufferLength += 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");+@Overridepublic final void backup(int amount) {bufferPosition -= amount;