[
https://issues.apache.org/jira/browse/DERBY-2191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465197
]
Dyre Tjeldvoll commented on DERBY-2191:
---------------------------------------
I'm looking at how boundary checking could be improved in this class, but I'm a
bit unsure about what the best approach is. Right now I have a patch in my
sandbox that introduces a private checkPosition() method that is used in all
accessors (isSet(), set(), clear()), which throws IllegalArgumentException if
the position is negative or larger than the largest legal bit position. This
gives a clean interface where all illegal positions are handled uniformly and
the test looks cleaner. But I'm a bit uncomfortable with all this extra
checking for an internal interface that only developers will use.
If we accept that using a negative bit doesn't result in the same exception
being thrown we could cut down on the testing since a negative bit index always
will result in an exception. If we can accept that access to illegal bit
positions in the last byte go undetected we could drop the extra check
altogether... (there is, of course, the issue of what set(illegalIndex) should
do. Nothing?)
Another more radical solution is to require bitset sizes to be a multiple of 8.
Then one would not need to track the number of bits used. This would only be
possible if we remove concatenate() (which is unused).
> Cleanup of FormatableBitSet
> ---------------------------
>
> Key: DERBY-2191
> URL: https://issues.apache.org/jira/browse/DERBY-2191
> Project: Derby
> Issue Type: Improvement
> Components: Miscellaneous
> Affects Versions: 10.2.1.6
> Reporter: Dyre Tjeldvoll
> Assigned To: Dyre Tjeldvoll
> Priority: Trivial
> Fix For: 10.3.0.0
>
> Attachments: deadcode.v1.diff, deadcode.v2.diff, fbstst.v1.diff,
> fbstst.v1.stat, FormatableBitSetTest.java, valuenotnull.v1.diff,
> valuenotnull.v1.stat
>
>
> The implementation of FormatableBitSet could be streamlined. Dead code can be
> removed and the implementation of some methods can be simplified.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira