-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
AVRO-3938: [Java] Add null guards for Schema.Parser #2738
Conversation
The `Schema.Parser` class has a private final property `validate`. This means that the value provided to its constructor is saved and cannot be changed at a later time. However, if `null` is passed as `validate`, then it is bound to throw a `NullPointerException` at an arbitrary time. This commit adds a fail-fast guard against `null` to prevent this.
@martin-g How do you think the test should be modified? I can't think of how to verify the change and honestly don't think one is strictly needed here. |
Co-authored-by: Martin Grigorov <[email protected]>
IMO the test should verify that the Parser behaves the same way as when |
@martin-g Just pushed a new test case involving an empty string as a name. PTAL. |
@martin-g Seems the PR passed the checks. Could you checki if this PR could be merged by any chance? Thanks. |
Thank you, @pingpingy1 ! |
* AVRO-3938: Add null guards for Schema.Parser The `Schema.Parser` class has a private final property `validate`. This means that the value provided to its constructor is saved and cannot be changed at a later time. However, if `null` is passed as `validate`, then it is bound to throw a `NullPointerException` at an arbitrary time. This commit adds a fail-fast guard against `null` to prevent this. * Apply suggestions from code review Co-authored-by: Martin Grigorov <[email protected]> * Modify test case --------- Co-authored-by: Martin Grigorov <[email protected]>
What is the purpose of the change
This pull request provides a fail-fast guard against the
private final
propertySchema.Parser.validate
, implementing AVRO-3938.Verifying this change
This change added the test
TestSchema.testParserNullValidate
.Documentation