Skip to content

Commit c9a4901

Browse files
committed
assert index
1 parent d5c9142 commit c9a4901

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/org/elasticsearch/common/util/CountedBitSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public CountedBitSet(short numBits) {
3939

4040
@Override
4141
public boolean get(int index) {
42-
assert index >= 0;
42+
assert 0 <= index && index < this.length();
4343
assert bitset == null || onBits < bitset.length() : "Bitset should be released when all bits are set";
4444

4545
return bitset == null ? true : bitset.get(index);
4646
}
4747

4848
@Override
4949
public void set(int index) {
50-
assert index >= 0;
50+
assert 0 <= index && index < this.length();
5151
assert bitset == null || onBits < bitset.length() : "Bitset should be released when all bits are set";
5252

5353
// Ignore set when bitset is full.

0 commit comments

Comments
 (0)