diff --git a/clients/src/main/java/org/apache/kafka/common/serialization/UUIDDeserializer.java b/clients/src/main/java/org/apache/kafka/common/serialization/UUIDDeserializer.java index 6b245bf33d0f6..779a9bd1529de 100644 --- a/clients/src/main/java/org/apache/kafka/common/serialization/UUIDDeserializer.java +++ b/clients/src/main/java/org/apache/kafka/common/serialization/UUIDDeserializer.java @@ -36,7 +36,7 @@ public void configure(Map configs, boolean isKey) { Object encodingValue = configs.get(propertyName); if (encodingValue == null) encodingValue = configs.get("deserializer.encoding"); - if (encodingValue != null && encodingValue instanceof String) + if (encodingValue instanceof String) encoding = (String) encodingValue; } diff --git a/shell/src/main/java/org/apache/kafka/shell/CommandUtils.java b/shell/src/main/java/org/apache/kafka/shell/CommandUtils.java index 0639172e95d38..5febfb835a549 100644 --- a/shell/src/main/java/org/apache/kafka/shell/CommandUtils.java +++ b/shell/src/main/java/org/apache/kafka/shell/CommandUtils.java @@ -113,7 +113,7 @@ public static void completePath(MetadataNodeManager nodeManager, pathComponents.size() : pathComponents.size() - 1; for (int i = 0; i < numDirectories; i++) { MetadataNode node = directory.child(pathComponents.get(i)); - if (node == null || !(node instanceof DirectoryNode)) { + if (!(node instanceof DirectoryNode)) { return; } directory = (DirectoryNode) node; diff --git a/shell/src/main/java/org/apache/kafka/shell/MetadataNode.java b/shell/src/main/java/org/apache/kafka/shell/MetadataNode.java index 3764a17b8b098..ad0b3cbc0a03b 100644 --- a/shell/src/main/java/org/apache/kafka/shell/MetadataNode.java +++ b/shell/src/main/java/org/apache/kafka/shell/MetadataNode.java @@ -54,7 +54,7 @@ public void rmrf(String... names) { DirectoryNode node = this; for (int i = 0; i < names.length - 1; i++) { MetadataNode nextNode = node.children.get(names[i]); - if (nextNode == null || !(nextNode instanceof DirectoryNode)) { + if (!(nextNode instanceof DirectoryNode)) { throw new RuntimeException("Unable to locate directory /" + String.join("/", names)); } @@ -95,7 +95,7 @@ public DirectoryNode directory(String... names) { DirectoryNode node = this; for (int i = 0; i < names.length; i++) { MetadataNode nextNode = node.children.get(names[i]); - if (nextNode == null || !(nextNode instanceof DirectoryNode)) { + if (!(nextNode instanceof DirectoryNode)) { throw new RuntimeException("Unable to locate directory /" + String.join("/", names)); } @@ -111,14 +111,14 @@ public FileNode file(String... names) { DirectoryNode node = this; for (int i = 0; i < names.length - 1; i++) { MetadataNode nextNode = node.children.get(names[i]); - if (nextNode == null || !(nextNode instanceof DirectoryNode)) { + if (!(nextNode instanceof DirectoryNode)) { throw new RuntimeException("Unable to locate file /" + String.join("/", names)); } node = (DirectoryNode) nextNode; } MetadataNode nextNode = node.child(names[names.length - 1]); - if (nextNode == null || !(nextNode instanceof FileNode)) { + if (!(nextNode instanceof FileNode)) { throw new RuntimeException("Unable to locate file /" + String.join("/", names)); }