Skip to content

Conversation

@jianghuazhu
Copy link
Contributor

What changes were proposed in this pull request?

When executing RaftServerImpl#getTransactionContext(), it may return null. We should add some assertions.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/RATIS-2288

How was this patch tested?

ci:
https://github.com/jianghuazhu/ratis/actions/runs/14897497515

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

@jianghuazhu , thanks for working on this!

This change is really minor. How about we combine it with some other changes such as RATIS-2180? Otherwise, it won't be scale.

break;
case STATEMACHINELOGENTRY:
TransactionContext trx = getTransactionContext(next, true);
Preconditions.assertNotNull(trx, "trx");
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use

Objects.requireNonNull(trx, "trx == null");

We added it for the pre Java 7 JDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @Szeto for the comment and review.
I will fix this in RATIS-2180.

@jianghuazhu jianghuazhu closed this May 9, 2025
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.

2 participants