Skip to content

Add null guards for TsFileExecutor constructor#50

Open
pingpingy1 wants to merge 2 commits intoapache:developfrom
pingpingy1:develop
Open

Add null guards for TsFileExecutor constructor#50
pingpingy1 wants to merge 2 commits intoapache:developfrom
pingpingy1:develop

Conversation

@pingpingy1
Copy link
Copy Markdown

Description

(Copied from Apache IoTDB PR#12013.)

This PR intends to provide null guards in the TsFileExecutor's constructors.
The inputs to the constructor of TsFileExecutor are immediately saved to the executor's private properties, which cannot neither be changed elsewhere nor are they guarded against null in other methods of the class.
Even though null inputs to the constructor make little sense, allowing them to be null makes debugging any subsequent NullPointerExceptions convoluted.
This PR uses the Object.requireNonNull method for a fail-fast guard against null inputs.


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

The inputs to the constructor of `TsFileExecutor` is immediately saved
to the executor's private properties, which cannot neither be changed
elsewhere nor are they guarded against `null` in other methods of the
class.
This commit adds guards such for a fail-fast guard against `null`
inputs.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Hi, this is your first pull request in the Apache TsFile project. Thanks for your contribution! TsFile will be better because of you.

The inputs to the constructor of `TsFileExecutor` is immediately saved
to the executor's private properties, which cannot neither be changed
elsewhere nor are they guarded against `null` in other methods of the
class.
This commit adds guards such for a fail-fast guard against `null`
inputs.
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.

1 participant