Skip to content

Commit 0c32742

Browse files
committed
Collapse these checks, too
Since we're tidying the map as we go, it's harder to reason about whether the error is that the set is null versus if the set doesn't contain one entry in particular, so treat those conditions as being the same.
1 parent 83682ea commit 0c32742

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCache.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,7 @@ public String toString() {
415415
void verifyInternalConsistency() {
416416
bitsetCache.keys().forEach(cacheKey -> {
417417
final Set<BitsetCacheKey> keys = keysByIndex.get(cacheKey.indexKey);
418-
if (keys == null) {
419-
throw new IllegalStateException(
420-
"Key [" + cacheKey + "] is in the cache, but there is no entry for [" + cacheKey.indexKey + "] in the lookup map"
421-
);
422-
}
423-
if (keys.contains(cacheKey) == false) {
418+
if (keys == null || keys.contains(cacheKey) == false) {
424419
throw new IllegalStateException(
425420
"Key [" + cacheKey + "] is in the cache, but the lookup entry for [" + cacheKey.indexKey + "] does not contain that key"
426421
);

0 commit comments

Comments
 (0)