lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Miller (JIRA)" <j...@apache.org>
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
                 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message