From 9e2322c5c07fb197ccabdf71f3fda6f70a0c9471 Mon Sep 17 00:00:00 2001 From: Daniel Naber Date: Fri, 6 Aug 2004 20:19:13 +0000 Subject: [PATCH] remove "throws IOException" from methods that really never throw this exception git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150397 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/search/BooleanScorer.java | 8 ++++---- src/java/org/apache/lucene/search/ConjunctionScorer.java | 6 +++--- .../org/apache/lucene/search/FieldDocSortedHitQueue.java | 5 +---- src/java/org/apache/lucene/search/FilteredTermEnum.java | 2 +- src/java/org/apache/lucene/search/PhrasePositions.java | 2 +- src/java/org/apache/lucene/search/PhraseScorer.java | 2 +- src/java/org/apache/lucene/search/SloppyPhraseScorer.java | 2 +- src/java/org/apache/lucene/search/TermScorer.java | 4 ++-- 8 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/java/org/apache/lucene/search/BooleanScorer.java b/src/java/org/apache/lucene/search/BooleanScorer.java index 0f37585de0f..dc0e57bbe77 100644 --- a/src/java/org/apache/lucene/search/BooleanScorer.java +++ b/src/java/org/apache/lucene/search/BooleanScorer.java @@ -77,7 +77,7 @@ final class BooleanScorer extends Scorer { bucketTable.newCollector(mask), scorers); } - private final void computeCoordFactors() throws IOException { + private final void computeCoordFactors() { coordFactors = new float[maxCoord]; for (int i = 0; i < maxCoord; i++) coordFactors[i] = getSimilarity().coord(i, maxCoord-1); @@ -120,7 +120,7 @@ final class BooleanScorer extends Scorer { return false; } - public float score() throws IOException { + public float score() { if (coordFactors == null) computeCoordFactors(); return current.score * coordFactors[current.coord]; @@ -185,11 +185,11 @@ final class BooleanScorer extends Scorer { } } - public boolean skipTo(int target) throws IOException { + public boolean skipTo(int target) { throw new UnsupportedOperationException(); } - public Explanation explain(int doc) throws IOException { + public Explanation explain(int doc) { throw new UnsupportedOperationException(); } diff --git a/src/java/org/apache/lucene/search/ConjunctionScorer.java b/src/java/org/apache/lucene/search/ConjunctionScorer.java index fcc25a61e55..cc756a8c495 100644 --- a/src/java/org/apache/lucene/search/ConjunctionScorer.java +++ b/src/java/org/apache/lucene/search/ConjunctionScorer.java @@ -30,7 +30,7 @@ final class ConjunctionScorer extends Scorer { super(similarity); } - final void add(Scorer scorer) throws IOException { + final void add(Scorer scorer) { scorers.addLast(scorer); } @@ -92,7 +92,7 @@ final class ConjunctionScorer extends Scorer { firstTime = false; } - private void sortScorers() throws IOException { + private void sortScorers() { // move scorers to an array Scorer[] array = (Scorer[])scorers.toArray(new Scorer[scorers.size()]); scorers.clear(); // empty the list @@ -112,7 +112,7 @@ final class ConjunctionScorer extends Scorer { } } - public Explanation explain(int doc) throws IOException { + public Explanation explain(int doc) { throw new UnsupportedOperationException(); } diff --git a/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java b/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java index 0f336d36774..3467553a310 100644 --- a/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java +++ b/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java @@ -18,7 +18,6 @@ package org.apache.lucene.search; import org.apache.lucene.util.PriorityQueue; -import java.io.IOException; import java.text.Collator; import java.util.Locale; @@ -48,10 +47,8 @@ extends PriorityQueue { * Creates a hit queue sorted by the given list of fields. * @param fields Field names, in priority order (highest priority first). * @param size The number of hits to retain. Must be greater than zero. - * @throws IOException */ - FieldDocSortedHitQueue (SortField[] fields, int size) - throws IOException { + FieldDocSortedHitQueue (SortField[] fields, int size) { this.fields = fields; this.collators = hasCollators (fields); initialize (size); diff --git a/src/java/org/apache/lucene/search/FilteredTermEnum.java b/src/java/org/apache/lucene/search/FilteredTermEnum.java index 7bc373bb5b2..945ce5ba9a6 100644 --- a/src/java/org/apache/lucene/search/FilteredTermEnum.java +++ b/src/java/org/apache/lucene/search/FilteredTermEnum.java @@ -28,7 +28,7 @@ public abstract class FilteredTermEnum extends TermEnum { private Term currentTerm = null; private TermEnum actualEnum = null; - public FilteredTermEnum() throws IOException {} + public FilteredTermEnum() {} /** Equality compare on the term */ protected abstract boolean termCompare(Term term); diff --git a/src/java/org/apache/lucene/search/PhrasePositions.java b/src/java/org/apache/lucene/search/PhrasePositions.java index e035e7b82d6..a4f13627338 100644 --- a/src/java/org/apache/lucene/search/PhrasePositions.java +++ b/src/java/org/apache/lucene/search/PhrasePositions.java @@ -27,7 +27,7 @@ final class PhrasePositions { TermPositions tp; // stream of positions PhrasePositions next; // used to make lists - PhrasePositions(TermPositions t, int o) throws IOException { + PhrasePositions(TermPositions t, int o) { tp = t; offset = o; } diff --git a/src/java/org/apache/lucene/search/PhraseScorer.java b/src/java/org/apache/lucene/search/PhraseScorer.java index afeaf4c0918..57012c6a92b 100644 --- a/src/java/org/apache/lucene/search/PhraseScorer.java +++ b/src/java/org/apache/lucene/search/PhraseScorer.java @@ -33,7 +33,7 @@ abstract class PhraseScorer extends Scorer { private float freq; PhraseScorer(Weight weight, TermPositions[] tps, Similarity similarity, - byte[] norms) throws IOException { + byte[] norms) { super(similarity); this.norms = norms; this.weight = weight; diff --git a/src/java/org/apache/lucene/search/SloppyPhraseScorer.java b/src/java/org/apache/lucene/search/SloppyPhraseScorer.java index 543970c20dd..40768cfaffd 100644 --- a/src/java/org/apache/lucene/search/SloppyPhraseScorer.java +++ b/src/java/org/apache/lucene/search/SloppyPhraseScorer.java @@ -24,7 +24,7 @@ final class SloppyPhraseScorer extends PhraseScorer { private int slop; SloppyPhraseScorer(Weight weight, TermPositions[] tps, Similarity similarity, - int slop, byte[] norms) throws IOException { + int slop, byte[] norms) { super(weight, tps, similarity, norms); this.slop = slop; } diff --git a/src/java/org/apache/lucene/search/TermScorer.java b/src/java/org/apache/lucene/search/TermScorer.java index 57241a73bd0..4e36a6c3b21 100644 --- a/src/java/org/apache/lucene/search/TermScorer.java +++ b/src/java/org/apache/lucene/search/TermScorer.java @@ -36,7 +36,7 @@ final class TermScorer extends Scorer { private float[] scoreCache = new float[SCORE_CACHE_SIZE]; TermScorer(Weight weight, TermDocs td, Similarity similarity, - byte[] norms) throws IOException { + byte[] norms) { super(similarity); this.weight = weight; this.termDocs = td; @@ -65,7 +65,7 @@ final class TermScorer extends Scorer { return true; } - public float score() throws IOException { + public float score() { int f = freqs[pointer]; float raw = // compute tf(f)*weight f < SCORE_CACHE_SIZE // check cache