[
https://issues.apache.org/jira/browse/AVRO-3938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17819147#comment-17819147
]
ASF subversion and git services commented on AVRO-3938:
-------------------------------------------------------
Commit 642e2705f7481e9bfa3c7598b70e17a3d9adcd8a in avro's branch
refs/heads/main from Heewon Lee
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=642e2705f ]
AVRO-3938: [Java] Add null guards for Schema.Parser (#2738)
* 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]>
> Schema.Parser.validate should not be null
> -----------------------------------------
>
> Key: AVRO-3938
> URL: https://issues.apache.org/jira/browse/AVRO-3938
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.11.3
> Reporter: Heewon Lee
> Priority: Trivial
> Labels: pull-request-available
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> The class `org.apache.avro.Schema.Parser` has a private final property
> `validate`. This implies that should `null` be passed to the constructor, it
> is destined to throw an NPE at a later, arbitrary time when `validate` will
> be used.
> Thus, I propose a simple one-line guard against `null` here for a fail-fast
> error, which would allow for a much easier debugging.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)