From 275b1f84f14603a6c56884d4efd5eb093b09264d Mon Sep 17 00:00:00 2001 From: Roon <100839953+roon-replica@users.noreply.github.com> Date: Mon, 11 Sep 2023 20:30:57 +0900 Subject: [PATCH] KAFKA-15315: Use getOrDefault rather than get in TransactionState (#14167) Reviewers: Ziming Deng dengziming1993@gmail.com. --- .../java/org/apache/kafka/clients/admin/TransactionState.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/TransactionState.java b/clients/src/main/java/org/apache/kafka/clients/admin/TransactionState.java index 9ff0966ae761a..bc994e450c2d2 100644 --- a/clients/src/main/java/org/apache/kafka/clients/admin/TransactionState.java +++ b/clients/src/main/java/org/apache/kafka/clients/admin/TransactionState.java @@ -49,8 +49,7 @@ public String toString() { } public static TransactionState parse(String name) { - TransactionState state = NAME_TO_ENUM.get(name); - return state == null ? UNKNOWN : state; + return NAME_TO_ENUM.getOrDefault(name, UNKNOWN); } }