[ https://issues.apache.org/jira/browse/AVRO-1851?focusedWorklogId=711343&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-711343 ]
ASF GitHub Bot logged work on AVRO-1851: ---------------------------------------- Author: ASF GitHub Bot Created on: 19/Jan/22 11:53 Start Date: 19/Jan/22 11:53 Worklog Time Spent: 10m Work Description: martin-g closed pull request #1369: URL: https://github.com/apache/avro/pull/1369 -- 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: dev-unsubscr...@avro.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 711343) Time Spent: 1h 50m (was: 1h 40m) > Serialization of anonymous enum fails with nullable union > --------------------------------------------------------- > > Key: AVRO-1851 > URL: https://issues.apache.org/jira/browse/AVRO-1851 > Project: Apache Avro > Issue Type: Bug > Components: java > Affects Versions: 1.7.7, 1.11.0 > Reporter: Zack Kobza > Assignee: Martin Tzvetanov Grigorov > Priority: Minor > Labels: pull-request-available > Time Spent: 1h 50m > Remaining Estimate: 0h > > Error received when serializing an object containing a nullable anonymous > enum: > {noformat} > org.apache.avro.SchemaParseException: Empty name > at org.apache.avro.Schema.validateName(Schema.java:1108) > at org.apache.avro.Schema.access$200(Schema.java:80) > at org.apache.avro.Schema$Name.<init>(Schema.java:468) > at org.apache.avro.Schema.createRecord(Schema.java:151) > at > org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:466) > at > org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:189) > at org.apache.avro.reflect.ReflectData.isRecord(ReflectData.java:168) > at > org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:613) > at > org.apache.avro.specific.SpecificData.getSchemaName(SpecificData.java:265) > at > org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:602) > at > org.apache.avro.generic.GenericDatumWriter.resolveUnion(GenericDatumWriter.java:151) > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:71) > at > org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:143) > at > org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:114) > at > org.apache.avro.reflect.ReflectDatumWriter.writeField(ReflectDatumWriter.java:175) > at > org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:104) > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:66) > at > org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:143) > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:58) > at > org.apache.avro.reflect.TestReflectDatumReader.serializeWithReflectDatumWriter(TestReflectDatumReader.java:45) > at > org.apache.avro.reflect.TestReflectDatumReader.testWrite_AnonymousEnum(TestReflectDatumReader.java:53) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) > at org.junit.runners.ParentRunner.run(ParentRunner.java:300) > at org.junit.runner.JUnitCore.run(JUnitCore.java:157) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) > {noformat} > Here is a unit test derived from TestReflectDatumReader to reproduce: > {code} > @Test > public void testWrite_AnonymousEnum() throws IOException { > byte[] serializedBytes = > serializeWithReflectDatumWriter(new > MyObject(AnonymousEnum.A), MyObject.class, AllowNull.get()); > assertNotNull(serializedBytes); > } > enum AnonymousEnum { > A { > @Override > public String doSomething() { > return "A is doing something"; > } > }; > public abstract String doSomething(); > } > public static class MyObject { > private final AnonymousEnum ae; > public MyObject(AnonymousEnum ae) { > this.ae = ae; > } > } > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)