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); } }