lucene
1918
Anomaly identified by the detector. Please review whether this anomaly corresponds to a misuse.
5
org/apache/lucene/search/FieldCacheImpl$AutoCache.java
createValue(IndexReader, Entry)
class FieldCacheImpl.AutoCache { protected Object createValue(IndexReader reader, Entry entryKey) throws IOException { String field = StringHelper.intern((String) entryKey.field); TermEnum enumerator = reader.terms (new Term (field)); try { Term term = enumerator.term(); if (term == null) { throw new RuntimeException ("no terms in field " + field + " - cannot determine type"); } Object ret = null; if (term.field() == field) { String termtext = term.text().trim(); try { Integer.parseInt (termtext); ret = wrapper.getInts (reader, field); } catch (NumberFormatException nfe1) { try { Long.parseLong(termtext); ret = wrapper.getLongs (reader, field); } catch (NumberFormatException nfe2) { try { Float.parseFloat (termtext); ret = wrapper.getFloats (reader, field); } catch (NumberFormatException nfe3) { ret = wrapper.getStringIndex (reader, field); } } } } else { throw new RuntimeException ("field \"" + field + "\" does not appear to be indexed"); } return ret; } finally { enumerator.close(); } } }
ES: Comparison of String objects using == or != in org.apache.lucene.search.FieldCacheImpl$AutoCache.createValue(IndexReader, FieldCacheImpl$Entry)
ES_COMPARING_STRINGS_WITH_EQ