You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Claude Warren (Jira)" <ji...@apache.org> on 2022/06/11 12:08:00 UTC

[jira] [Updated] (COLLECTIONS-816) SimpleBloomFilter: There is no coverage of this branch. It is not possible.

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

Claude Warren updated COLLECTIONS-816:
--------------------------------------
    Summary: SimpleBloomFilter: There is no coverage of this branch. It is not possible.   (was: There is no coverage of this branch. It is not possible. )

> SimpleBloomFilter: There is no coverage of this branch. It is not possible. 
> ----------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-816
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-816
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Collection
>    Affects Versions: 4.5
>            Reporter: Claude Warren
>            Priority: Minor
>              Labels: bloom-filter
>
> Copied from Simplify Bloom Filters pull request.
> [https://github.com/apache/commons-collections/pull/258#discussion_r815505285]
>  
> [https://github.com/Claudenw/commons-collections/blob/9f2945cc98747893456b73f42ab53f46a866ac37/src/main/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilter.java#L165-L168]
>  
>  
> Member
> h3. !https://avatars.githubusercontent.com/u/886334?s=48&v=4|width=24,height=24! *[aherbert|https://github.com/aherbert]* [on 27 Feb|https://github.com/apache/commons-collections/pull/258#discussion_r815505285]
> There is no coverage of this branch. It is not possible. If this were true the bitMap[idx[0]] in the main forEach loop would have thrown an array index out of bound exception. I think this can be removed. The final check to determine if the final upper bitmap does not set incorrect bits is valid.
> Note: Even though the check is made that the upper bits have been set correctly, if they have not the exception is raised and the filter now has incorrect bits for the rest of its lifetime, i.e. no recovery is made and no flag is present in the filter to indicate the bits are bad. So you could then merge this into another filter and get the same exception, or record the bits to file and have bad bits in the recording, etc.
> The same 'bug' is present in the SparseBloomFilter. It will raise an exception after merge if the TreeSet first or last position are outside the shape but not correct it.
> I think these filters should attempt to clear any invalid bits before throwing exceptions. This makes them act as if they are a plain {{int[]}} of size {{nbits}} containing 0 or 1s. It should not be possible to put an index outside the range of the shape in the filter.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)