minor/nitpick TermInfoReader bug ? ---------------------------------- Key: LUCENE-1832 URL: https://issues.apache.org/jira/browse/LUCENE-1832 Project: Lucene - Java Issue Type: Bug Reporter: Mark Miller Priority: Trivial Fix For: 2.9
Some code flagged by a bytecode static analyzer - I guess a nitpick, but we should just drop the null check in the if? If its null it will fall to the below code and then throw a NullPointer exception anyway. Keeping the nullpointer check implies we expect its possible - but then we don't handle it correctly. {code} /** Returns the nth term in the set. */ final Term get(int position) throws IOException { if (size == 0) return null; SegmentTermEnum enumerator = getThreadResources().termEnum; if (enumerator != null && enumerator.term() != null && position >= enumerator.position && position < (enumerator.position + totalIndexInterval)) return scanEnum(enumerator, position); // can avoid seek seekEnum(enumerator, position/totalIndexInterval); // must seek return scanEnum(enumerator, position); } {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org