Skip to content

Commit dfcc776

Browse files
remove redundant conditional
1 parent 83f2ef8 commit dfcc776

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

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

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -631,30 +631,26 @@ private void runRequestInterceptors(
631631
AuthorizationEngine authorizationEngine,
632632
ActionListener<Void> listener
633633
) {
634-
if (requestInterceptors.isEmpty()) {
635-
listener.onResponse(null);
636-
} else {
637-
final Iterator<RequestInterceptor> requestInterceptorIterator = requestInterceptors.iterator();
638-
while (requestInterceptorIterator.hasNext()) {
639-
var res = requestInterceptorIterator.next().intercept(requestInfo, authorizationEngine, authorizationInfo);
640-
if (res.isSuccess() == false) {
641-
res.addListener(new DelegatingActionListener<>(listener) {
642-
@Override
643-
public void onResponse(Void unused) {
644-
if (requestInterceptorIterator.hasNext()) {
645-
requestInterceptorIterator.next()
646-
.intercept(requestInfo, authorizationEngine, authorizationInfo)
647-
.addListener(this);
648-
} else {
649-
delegate.onResponse(null);
650-
}
634+
final Iterator<RequestInterceptor> requestInterceptorIterator = requestInterceptors.iterator();
635+
while (requestInterceptorIterator.hasNext()) {
636+
var res = requestInterceptorIterator.next().intercept(requestInfo, authorizationEngine, authorizationInfo);
637+
if (res.isSuccess() == false) {
638+
res.addListener(new DelegatingActionListener<>(listener) {
639+
@Override
640+
public void onResponse(Void unused) {
641+
if (requestInterceptorIterator.hasNext()) {
642+
requestInterceptorIterator.next()
643+
.intercept(requestInfo, authorizationEngine, authorizationInfo)
644+
.addListener(this);
645+
} else {
646+
delegate.onResponse(null);
651647
}
652-
});
653-
return;
654-
}
648+
}
649+
});
650+
return;
655651
}
656-
listener.onResponse(null);
657652
}
653+
listener.onResponse(null);
658654
}
659655

660656
// pkg-private for testing

0 commit comments

Comments
 (0)