Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-15315: Use getOrDefault rather than get in TransactionState #14167

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

roon-replica
Copy link
Contributor

@roon-replica roon-replica commented Aug 8, 2023

I simplified the code for getting value from map in TransactionState

@roon-replica roon-replica changed the title use getOrDefault rather get in TransactionState Minor:KAFKA-15315: Use getOrDefault rather than get in TransactionState Aug 12, 2023
@roon-replica roon-replica changed the title Minor:KAFKA-15315: Use getOrDefault rather than get in TransactionState KAFKA-15315: Use getOrDefault rather than get in TransactionState Aug 12, 2023
Copy link
Member

@dengziming dengziming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dengziming dengziming merged commit 7fc6500 into apache:trunk Sep 11, 2023
@@ -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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

AnatolyPopov pushed a commit to aiven/kafka that referenced this pull request Feb 16, 2024
Cerchie pushed a commit to Cerchie/kafka that referenced this pull request Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants