LUCENE-3684: use UOE not IAE

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1231799 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-01-16 00:00:50 +00:00
parent 87bc4521c2
commit 57adb4371a
6 changed files with 6 additions and 6 deletions

View File

@ -156,7 +156,7 @@ public final class Lucene40PostingsWriter extends PostingsWriterBase {
this.fieldInfo = fieldInfo;
indexOptions = fieldInfo.indexOptions;
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
throw new IllegalArgumentException("this codec cannot index offsets");
throw new UnsupportedOperationException("this codec cannot index offsets");
}
storePayloads = fieldInfo.storePayloads;

View File

@ -254,7 +254,7 @@ public class MemoryPostingsFormat extends PostingsFormat {
@Override
public TermsConsumer addField(FieldInfo field) {
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
throw new IllegalArgumentException("this codec cannot index offsets");
throw new UnsupportedOperationException("this codec cannot index offsets");
}
if (VERBOSE) System.out.println("\naddField field=" + field.name);
return new TermsWriter(out, field);

View File

@ -116,7 +116,7 @@ public final class PulsingPostingsWriter extends PostingsWriterBase {
public void setField(FieldInfo fieldInfo) {
this.indexOptions = fieldInfo.indexOptions;
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
throw new IllegalArgumentException("this codec cannot index offsets: " + indexOptions);
throw new UnsupportedOperationException("this codec cannot index offsets: " + indexOptions);
}
if (DEBUG) System.out.println("PW field=" + fieldInfo.name + " indexOptions=" + indexOptions);
storePayloads = fieldInfo.storePayloads;

View File

@ -189,7 +189,7 @@ public final class SepPostingsWriter extends PostingsWriterBase {
this.fieldInfo = fieldInfo;
this.indexOptions = fieldInfo.indexOptions;
if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
throw new IllegalArgumentException("this codec cannot index offsets");
throw new UnsupportedOperationException("this codec cannot index offsets");
}
skipListWriter.setIndexOptions(indexOptions);
storePayloads = indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS && fieldInfo.storePayloads;

View File

@ -89,7 +89,7 @@ class PreFlexFieldsWriter extends FieldsConsumer {
public TermsConsumer addField(FieldInfo field) throws IOException {
assert field.number != -1;
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
throw new IllegalArgumentException("this codec cannot index offsets");
throw new UnsupportedOperationException("this codec cannot index offsets");
}
//System.out.println("w field=" + field.name + " storePayload=" + field.storePayloads + " number=" + field.number);
return new PreFlexTermsWriter(field);

View File

@ -199,7 +199,7 @@ public class RAMOnlyPostingsFormat extends PostingsFormat {
@Override
public TermsConsumer addField(FieldInfo field) {
if (field.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) {
throw new IllegalArgumentException("this codec cannot index offsets");
throw new UnsupportedOperationException("this codec cannot index offsets");
}
RAMField ramField = new RAMField(field.name);
postings.fieldToTerms.put(field.name, ramField);