github-advanced-security[bot] commented on code in PR #2642: URL: https://github.com/apache/avro/pull/2642#discussion_r1504196997
########## lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SchemaTask.java: ########## @@ -17,20 +17,21 @@ */ package org.apache.avro.compiler.specific; +import org.apache.avro.Schema; +import org.apache.avro.SchemaParser; + import java.io.File; import java.io.IOException; -import org.apache.avro.Schema; - /** Ant task to generate Java interface and classes for a protocol. */ public class SchemaTask extends ProtocolTask { @Override protected void doCompile(File src, File dest) throws IOException { - final Schema.Parser parser = new Schema.Parser(); - final Schema schema = parser.parse(src); + final SchemaParser parser = new SchemaParser(); + final Schema schema = parser.resolve(parser.parse(src)); Review Comment: ## Deprecated method or constructor invocation Invoking [SchemaParser.resolve](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/avro/security/code-scanning/3195) ########## lang/java/compiler/src/test/java/org/apache/avro/specific/TestSpecificData.java: ########## @@ -45,26 +42,29 @@ import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; - -import org.apache.avro.Schema; -import org.apache.avro.compiler.specific.SpecificCompiler; -import org.apache.avro.generic.GenericData; -import org.apache.avro.generic.GenericDatumWriter; -import org.apache.avro.generic.GenericRecord; -import org.apache.avro.io.DatumWriter; -import org.apache.avro.io.DecoderFactory; -import org.apache.avro.io.Encoder; -import org.apache.avro.io.EncoderFactory; - -import org.junit.jupiter.api.Test; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.fail; public class TestSpecificData { @Test void separateThreadContextClassLoader() throws Exception { - Schema schema = new Schema.Parser().parse(new File("src/test/resources/foo.Bar.avsc")); + SchemaParser parser = new SchemaParser(); + Schema schema = parser.resolve(parser.parse(new File("src/test/resources/foo.Bar.avsc"))); Review Comment: ## Deprecated method or constructor invocation Invoking [SchemaParser.resolve](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/avro/security/code-scanning/3196) ########## lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestInduceMojo.java: ########## @@ -61,7 +61,8 @@ assertTrue(outputDir.listFiles().length != 0); File personSchemaFile = Arrays.stream(outputDir.listFiles()).filter(file -> file.getName().endsWith("Person.avsc")) .findFirst().orElseThrow(AssertionError::new); - assertEquals(ReflectData.get().getSchema(Person.class), new Schema.Parser().parse(personSchemaFile)); + SchemaParser parser = new SchemaParser(); + assertEquals(ReflectData.get().getSchema(Person.class), parser.resolve(parser.parse(personSchemaFile))); Review Comment: ## Deprecated method or constructor invocation Invoking [SchemaParser.resolve](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/avro/security/code-scanning/3199) ########## lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java: ########## @@ -731,24 +736,28 @@ @Test void logicalTypesWithMultipleFields() throws Exception { - Schema logicalTypesWithMultipleFields = new Schema.Parser() - .parse(new File("src/test/resources/logical_types_with_multiple_fields.avsc")); + Schema logicalTypesWithMultipleFields = parseFile( + new File("src/test/resources/logical_types_with_multiple_fields.avsc")); assertCompilesWithJavaCompiler(new File(OUTPUT_DIR, "testLogicalTypesWithMultipleFields"), new SpecificCompiler(logicalTypesWithMultipleFields).compile(), true); } + private static Schema parseFile(File file) throws IOException { + SchemaParser schemaParser = new SchemaParser(); + return schemaParser.resolve(schemaParser.parse(file)); Review Comment: ## Deprecated method or constructor invocation Invoking [SchemaParser.resolve](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/avro/security/code-scanning/3198) ########## lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java: ########## @@ -147,8 +149,8 @@ } private SpecificCompiler createCompiler() throws IOException { - Schema.Parser parser = new Schema.Parser(); - Schema schema = parser.parse(this.src); + SchemaParser parser = new SchemaParser(); + Schema schema = parser.resolve(parser.parse(this.src)); Review Comment: ## Deprecated method or constructor invocation Invoking [SchemaParser.resolve](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/avro/security/code-scanning/3197) -- 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-unsubscr...@avro.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org