Skip to content

Commit 0561be0

Browse files
committed
Fix assert
1 parent bc1cee5 commit 0561be0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/AuthorizationService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,11 @@ private void authorizeAction(
485485
// The most common case is when a child action is authorized based on its parent, in that case we never need
486486
// to lookup indices, so we never need the project metadata.
487487
// But we do want to optimize by only looking up the project once for each action, so we use a cached supplier.
488-
final Supplier<ProjectMetadata> projectMetadataSupplier = CachedSupplier.wrap(
489-
() -> projectResolver.getProjectMetadata(clusterService.state())
490-
);
491-
assert projectMetadataSupplier != null;
488+
final Supplier<ProjectMetadata> projectMetadataSupplier = CachedSupplier.wrap(() -> {
489+
final ProjectMetadata projectMetadata = projectResolver.getProjectMetadata(clusterService.state());
490+
assert projectMetadata != null;
491+
return projectMetadata;
492+
});
492493
final AsyncSupplier<ResolvedIndices> resolvedIndicesAsyncSupplier = new CachingAsyncSupplier<>(resolvedIndicesListener -> {
493494
if (request instanceof SearchRequest searchRequest && searchRequest.pointInTimeBuilder() != null) {
494495
var resolvedIndices = indicesAndAliasesResolver.resolvePITIndices(searchRequest);

0 commit comments

Comments
 (0)