Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-822

BloomFilter: change ArrayCountinBloomFilter constructor exception type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 4.5
    • 4.5
    • Collection

    Description

      src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
       

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

      catch (IndexOutOfBoundsException e) {

      throw new IllegalArgumentException(

       
       
       
      Member

      aherbert on 27 Feb

      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.
       

      Claude-at-Instaclustr on 10 Mar

      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.
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              claude Claude Warren
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: