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/15 08:20:00 UTC

[jira] [Created] (COLLECTIONS-822) BloomFilter: change ArrayCountinBloomFilter constructor exception type

Claude Warren created COLLECTIONS-822:
-----------------------------------------

             Summary: BloomFilter: change ArrayCountinBloomFilter constructor exception type
                 Key: COLLECTIONS-822
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-822
             Project: Commons Collections
          Issue Type: Improvement
          Components: Collection
    Affects Versions: 4.5
            Reporter: Claude Warren


[src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java|https://github.com/apache/commons-collections/pull/258/files/c3d78d5a9c033e4ded1f95a3868395b71dbfcc12#diff-b4b8848c4ea950c78499756d5fcad26bda95cf076423283f8eb77d26838fcf95] 
 
| try {|


| filter.add(BitCountProducer.from(hasher.uniqueIndices(shape)));|


| } catch (IndexOutOfBoundsException e) {|

| throw new IllegalArgumentException(|
 
 
 
 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_r813354186]
Why change the IOOB exception to an IAE? Neither are documented to be thrown by either add or merge. So here you have inconsistent exceptions being thrown.

Note: If you rethrow the exception you should include the original exception as the cause.

I would just leave this as an IOOB exception and add it to the method javadocs that this will occur for invalid indices.
 
h3. !https://avatars.githubusercontent.com/u/89772101?s=48&v=4|width=24,height=24!  *[Claude-at-Instaclustr|https://github.com/Claude-at-Instaclustr]*  [on 10 Mar|https://github.com/apache/commons-collections/pull/258#discussion_r823925019]
I think this is a documentation issue. We have specific comments for mergeInPlace that states it throws an illgetlArgumentException on numbers out of range. merge() and mergeInPlace() need to be consistent across all the implementations. 
 



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