Montura commented on code in PR #7138:
URL: https://github.com/apache/ozone/pull/7138#discussion_r1742384383
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ClosePipelineSubcommand.java:
##########
@@ -59,12 +59,22 @@ public void execute(ScmClient scmClient) throws IOException
{
List<Pipeline> pipelineList = new ArrayList<>();
Predicate<? super Pipeline> predicate = replicationFilter.orElse(null);
- for (Pipeline pipeline : scmClient.listPipelines()) {
- boolean filterPassed = (predicate != null) && predicate.test(pipeline);
- if (pipeline.getPipelineState() != Pipeline.PipelineState.CLOSED &&
filterPassed) {
- pipelineList.add(pipeline);
+ List<Pipeline> pipelines = scmClient.listPipelines();
Review Comment:
I suggest to fix a condition without adding `if/else` block:
```
boolean filterPassed = (predicate == null) || predicate.test(pipeline);
```
I checked, tests are working
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]