Fix fall-through warning and ensure all variables are initialized (by finalness) and default switch throwing runtimeex

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1303449 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-03-21 15:45:25 +00:00
parent 1a191f4edc
commit acd6f46934
1 changed files with 8 additions and 3 deletions

View File

@ -70,8 +70,7 @@ public class SimpleTextDocValuesConsumer extends DocValuesConsumer {
@Override @Override
public void add(int docID, IndexableField value) throws IOException { public void add(int docID, IndexableField value) throws IOException {
assert docID >= 0; assert docID >= 0;
int ord = -1; final int ord, vSize;
int vSize = -1;
switch (type) { switch (type) {
case BYTES_FIXED_DEREF: case BYTES_FIXED_DEREF:
case BYTES_FIXED_SORTED: case BYTES_FIXED_SORTED:
@ -106,7 +105,12 @@ public class SimpleTextDocValuesConsumer extends DocValuesConsumer {
break; break;
case FIXED_INTS_64: case FIXED_INTS_64:
vSize = 8; vSize = 8;
scratch.grow(8);
DocValuesArraySource.copyLong(scratch, value.numericValue().longValue());
ord = hash.add(scratch);
break;
case VAR_INTS: case VAR_INTS:
vSize = -1;
scratch.grow(8); scratch.grow(8);
DocValuesArraySource.copyLong(scratch, value.numericValue().longValue()); DocValuesArraySource.copyLong(scratch, value.numericValue().longValue());
ord = hash.add(scratch); ord = hash.add(scratch);
@ -125,7 +129,8 @@ public class SimpleTextDocValuesConsumer extends DocValuesConsumer {
Double.doubleToRawLongBits(value.numericValue().doubleValue())); Double.doubleToRawLongBits(value.numericValue().doubleValue()));
ord = hash.add(scratch); ord = hash.add(scratch);
break; break;
default:
throw new RuntimeException("should not reach this line");
} }
if (fixedSize == Integer.MIN_VALUE) { if (fixedSize == Integer.MIN_VALUE) {