lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (LUCENE-1247) Unnecessary assert in org.apache.lucene.index.DocumentsWriterThreadState.trimFields()
Date Fri, 28 Mar 2008 09:06:24 GMT

     [ https://issues.apache.org/jira/browse/LUCENE-1247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael McCandless resolved LUCENE-1247.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4

Thanks David, I just removed this.

> Unnecessary assert in org.apache.lucene.index.DocumentsWriterThreadState.trimFields()
> -------------------------------------------------------------------------------------
>
>                 Key: LUCENE-1247
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1247
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.3.1, 2.3.2
>            Reporter: David Dillard
>            Priority: Trivial
>             Fix For: 2.4
>
>
> In org.apache.lucene.index.DocumentsWriterThreadState.trimFields() is the following code:
>       if (fp.lastGen == -1) {
>         // This field was not seen since the previous
>         // flush, so, free up its resources now
>         // Unhash
>         final int hashPos = fp.fieldInfo.name.hashCode() & fieldDataHashMask;
>         DocumentsWriterFieldData last = null;
>         DocumentsWriterFieldData fp0 = fieldDataHash[hashPos];
>         while(fp0 != fp) {
>           last = fp0;
>           fp0 = fp0.next;
>         }
>         assert fp0 != null;
> The assert at the end is not necessary as fp0 cannot be null.  The first line in the
above code guarantees that fp is not null by the time the while loop is hit.  The while loop
is exited when fp0 and fp are equal.  Since fp is not null then fp0 cannot be null when the
while loop is exited, thus the assert is guaranteed to never occur.
> This was detected by FindBugs.

-- 
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