Skip to content

Replace assert statements with explicit checks #4390

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

Merged
merged 1 commit into from
May 30, 2024

Conversation

hezhangjian
Copy link
Member

Main Issue #995

Motivation

In the current implementation, several components use assert statements to verify conditions. However, assert statements are not typically enabled in production environments, which means these checks can be bypassed, potentially leading to unclear errors later in the execution. Replacing these with explicit checks ensures that our error handling is active and clear during production runs.

Changes

  • BKLogSegmentWriter.java: Added a check to verify the context type before casting to BKTransmitPacket.
  • BKDLConfig.java: Introduced a check for the type of dlConfig before casting to BKDLConfig.
  • ZKVersionedSetOp.java: Added a check to ensure the operation result is of type OpResult.ErrorResult.

@hezhangjian hezhangjian force-pushed the remove-assert-instance-of branch from 49404a5 to e54d51b Compare May 29, 2024 00:11
@hezhangjian hezhangjian self-assigned this May 29, 2024
@hezhangjian hezhangjian added this to the 4.18.0 milestone May 29, 2024
@dlg99 dlg99 merged commit 9b15963 into apache:master May 30, 2024
24 of 25 checks passed
@hezhangjian hezhangjian deleted the remove-assert-instance-of branch May 30, 2024 23:25
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 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.

2 participants