diff --git a/src/java/org/apache/lucene/index/FieldInfos.java b/src/java/org/apache/lucene/index/FieldInfos.java index 16148f3d436..89553a91a2a 100644 --- a/src/java/org/apache/lucene/index/FieldInfos.java +++ b/src/java/org/apache/lucene/index/FieldInfos.java @@ -62,9 +62,10 @@ final class FieldInfos { /** Adds field info for a Document. */ public void add(Document doc) { - Enumeration fields = doc.fields(); - while (fields.hasMoreElements()) { - Fieldable field = (Fieldable) fields.nextElement(); + List fields = doc.getFields(); + Iterator fieldIterator = fields.iterator(); + while (fieldIterator.hasNext()) { + Fieldable field = (Fieldable) fieldIterator.next(); add(field.name(), field.isIndexed(), field.isTermVectorStored(), field.isStorePositionWithTermVector(), field.isStoreOffsetWithTermVector(), field.getOmitNorms()); }