You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "martin-g (via GitHub)" <gi...@apache.org> on 2024/02/15 08:35:57 UTC

Re: [PR] AVRO-3938: [Java] Add null guards for Schema.Parser [avro]

martin-g commented on code in PR #2738:
URL: https://github.com/apache/avro/pull/2738#discussion_r1490615146


##########
lang/java/avro/src/main/java/org/apache/avro/Schema.java:
##########
@@ -1497,7 +1497,7 @@ public Parser() {
     }
 
     public Parser(final NameValidator validate) {
-      this.validate = validate;
+      this.validate = Objects.requireNonNull(validate, "validate");

Review Comment:
   How about ?
   ```suggestion
         this.validate = validate != null ? validate : NameValidator.NO_VALIDATION);
   ```
   Schema.parse() uses `NameValidator.NO_VALIDATION` if there is no need to validate.
   I guess you use `Parser.parse()` directly and that's why you see NPEs later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org