[ https://issues.apache.org/jira/browse/AVRO-3940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17969559#comment-17969559 ]
ASF subversion and git services commented on AVRO-3940: ------------------------------------------------------- Commit a10fc5eaae3d5107b0266880472f6a03c9591f2b in avro's branch refs/heads/branch-1.12 from Michel Davit [ https://gitbox.apache.org/repos/asf?p=avro.git;h=a10fc5eaae ] AVRO-3940: [java] Allow schema redefinition when equal (#3304) ParseContext.put accept known schemas when strictly identical. Call to this method was made before schema was fully parsed avoiding exact schema redefinition in files. Call ParseContext.put when schema is fully parsed. This has an inpact on the schemas ordering returned by the parser. (cherry picked from commit cea41a49c89188bdff3a8fcd3f4ebb4e5ae2a2a1) > Failed to generate Java classes from multiple .avsc files containing same type > ------------------------------------------------------------------------------ > > Key: AVRO-3940 > URL: https://issues.apache.org/jira/browse/AVRO-3940 > Project: Apache Avro > Issue Type: Bug > Components: java > Affects Versions: 1.11.3 > Reporter: Patrick Wolleb > Priority: Major > Labels: pull-request-available > Fix For: 1.12.0 > > Attachments: avsc-java-generator.zip, programmes-key.avsc, > programmes-value.avsc > > Time Spent: 20m > Remaining Estimate: 0h > > I am unable to generate Java classes from two .avsc files that both contain > an identical record. I get a SchemaParseException: Can't redefine: > com.example.domain.Provenance. > * schema 1: [^programmes-key.avsc] > * schema 2: [^programmes-value.avsc] > I am not sure I understand the generator correctly since the the check to > throw the exception in this case was recently added for the code generation > via an Open API yaml https://issues.apache.org/jira/browse/AVRO-3805 > Here the commit in question: > [https://github.com/apache/avro/blame/c60e1a0cbf98412b1c65cb2d9029d32077d85574/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1753] > [~clesaec] > *Steps to reproduce:* > # Download [^avsc-java-generator.zip] > # Unzip and change into directory > # Run ./gradlew quarkusDev --stacktrace > # Observe SchemaParseException in output > *Expected:* > The generator should accept the same name and overwrite the output. > *Result:* > {code:java} > Caused by: org.apache.avro.SchemaParseException: Can't redefine: > com.example.domain.Provenance at > org.apache.avro.Schema$Names.put(Schema.java:1604) at > org.apache.avro.Schema$Names.add(Schema.java:1598) at > org.apache.avro.Schema.parse(Schema.java:1774) at > org.apache.avro.Schema.parse(Schema.java:1736) at > org.apache.avro.Schema$Parser.parse(Schema.java:1471) at > org.apache.avro.Schema$Parser.parse(Schema.java:1433) > {code} > > -- This message was sent by Atlassian Jira (v8.20.10#820010)