Skip to content

Commit

Permalink
Fix checkstyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaselenge committed Nov 8, 2024
1 parent 9fced08 commit ab3b3d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
def testListNodesWithFencedBroker(quorum: String): Unit = {
client = createAdminClient
val fencedBrokerId = brokers.last.config.brokerId
killBroker(fencedBrokerId)
killBroker(fencedBrokerId, JDuration.ofMillis(0))
// It takes a few seconds for a broker to get fenced after being killed
// So we retry until only 2 of 3 brokers returned in the result or the max wait is reached
TestUtils.retry(20000) {
Expand Down
20 changes: 10 additions & 10 deletions tools/src/main/java/org/apache/kafka/tools/ClusterTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.kafka.tools;

import java.util.Collection;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.DescribeClusterOptions;
import org.apache.kafka.common.Node;
Expand All @@ -34,6 +33,7 @@

import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -72,7 +72,7 @@ static void execute(String... args) throws Exception {
.help("Get information about the ID of a cluster.");
Subparser unregisterParser = subparsers.addParser("unregister")
.help("Unregister a broker.");
Subparser listEndpoints= subparsers.addParser("list-endpoints")
Subparser listEndpoints = subparsers.addParser("list-endpoints")
.help("List endpoints");
for (Subparser subpparser : Arrays.asList(clusterIdParser, unregisterParser, listEndpoints)) {
MutuallyExclusiveGroup connectionOptions = subpparser.addMutuallyExclusiveGroup().required(true);
Expand Down Expand Up @@ -165,7 +165,7 @@ static void listEndpoints(PrintStream stream, Admin adminClient, boolean listCon
String maxRackLength = String.valueOf(nodes.stream().filter(node -> node.hasRack()).map(node -> node.rack().length()).max(Integer::compareTo).orElse(10));

if (listControllerEndpoints) {
String format = "%-10s %-" + maxHostLength + "s %-10s %-"+ maxRackLength +"s %-15s%n";
String format = "%-10s %-" + maxHostLength + "s %-10s %-" + maxRackLength + "s %-15s%n";
stream.printf(format, "ID", "HOST", "PORT", "RACK", "ENDPOINT_TYPE");
nodes.stream().forEach(node -> stream.printf(format,
node.idString(),
Expand All @@ -175,7 +175,7 @@ static void listEndpoints(PrintStream stream, Admin adminClient, boolean listCon
"controller"
));
} else {
String format = "%-10s %-" + maxHostLength + "s %-10s %-"+ maxRackLength +"s %-10s %-15s%n";
String format = "%-10s %-" + maxHostLength + "s %-10s %-" + maxRackLength + "s %-10s %-15s%n";
stream.printf(format, "ID", "HOST", "PORT", "RACK", "STATE", "ENDPOINT_TYPE");
nodes.stream().forEach(node -> stream.printf(format,
node.idString(),
Expand All @@ -187,12 +187,12 @@ static void listEndpoints(PrintStream stream, Admin adminClient, boolean listCon
));
}
} catch (ExecutionException ee) {
Throwable cause = ee.getCause();
if (cause instanceof UnsupportedVersionException) {
stream.println(ee.getCause().getMessage());
} else {
throw ee;
}
Throwable cause = ee.getCause();
if (cause instanceof UnsupportedVersionException) {
stream.println(ee.getCause().getMessage());
} else {
throw ee;
}
}
}
}

0 comments on commit ab3b3d6

Please sign in to comment.