lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Miller (JIRA)" <>
Subject [jira] Created: (LUCENE-1832) minor/nitpick TermInfoReader bug ?
Date Thu, 20 Aug 2009 22:35:14 GMT
minor/nitpick TermInfoReader bug ?

                 Key: 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.

  /** 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);


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:
For additional commands, e-mail:

View raw message