Skip to content

Commit

Permalink
AVRO-3704: adapt validator
Browse files Browse the repository at this point in the history
  • Loading branch information
clesaec committed Sep 11, 2023
1 parent 05e8a56 commit 8cb6152
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lang/java/avro/src/main/java/org/apache/avro/Schema.java
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ private static interface ParseFunction {
}

private Schema runParser(JsonParser parser, ParseFunction f) throws IOException {
boolean saved = validateNames.get();
NameValidator saved = validateNames.get();
boolean savedValidateDefaults = VALIDATE_DEFAULTS.get();
try {
validateNames.set(validate);
Expand Down Expand Up @@ -1680,7 +1680,8 @@ public static Schema parse(String jsonSchema) {
*/
@Deprecated
public static Schema parse(String jsonSchema, boolean validate) {
return new Parser().setValidate(validate).parse(jsonSchema);
final NameValidator validator = validate ? NameValidator.UTF_VALIDATOR : NameValidator.NO_VALIDATION;
return new Parser(validator).parse(jsonSchema);
}

static final Map<String, Type> PRIMITIVES = new HashMap<>();
Expand Down

0 comments on commit 8cb6152

Please sign in to comment.