You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Dillard (JIRA)" <ji...@apache.org> on 2008/03/27 20:31:24 UTC
[jira] Created: (LUCENE-1247) Unnecessary assert in
org.apache.lucene.index.DocumentsWriterThreadState.trimFields()
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
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
[jira] Updated: (LUCENE-1247) Unnecessary assert in
org.apache.lucene.index.DocumentsWriterThreadState.trimFields()
Posted by "David Dillard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-1247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Dillard updated LUCENE-1247:
----------------------------------
Priority: Trivial (was: Major)
> 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
>
> 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
[jira] Resolved: (LUCENE-1247) Unnecessary assert in
org.apache.lucene.index.DocumentsWriterThreadState.trimFields()
Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
[ 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