obiba / genobyte

GenoByte is a Java API for storing and querying data resulting from the aggregation of high-throughput genotyping experiments across many subjects.
GNU General Public License v3.0
1 stars 0 forks source link

GEN-37: Bitwise operation methods (and, or, etc.) may cause an "ArrayOutOfBound" exception if the two BitVectors are not of the same size. #21

Open ymarcon opened 17 years ago

ymarcon commented 17 years ago

Jira issue originally created by user dbujold:

This happens in the case where the two BitVectors are storing bits in "long" vectors of different sizes. If the size of the BitVector on which the bitwise method is called is bigger than the one passed in parameter, there will be an "ArrayOutOfBound" exception.

Example: BitVector x = new BitVector(70); BitVector y = new BitVector(60);

"x.and(y)" will crash because y stores its bits in a single "long", while x stores its bits in two "longs".

ymarcon commented 16 years ago

Comment created by @plaflamme:

This issue will be documented in the concerned Javadoc methods. For efficiency, we don't want to implement a size check every time a bitwise operation is done. Therefore, the Javadoc will clearly mention that there should be no expected behaviour when two BitVector operands are of different size.

ymarcon commented 16 years ago

Comment created by @plaflamme:

It might be interesting later to investigate what the cost of an additional validation for robustness.