ErikJansenIRefact opened a new issue #7333:
URL: https://github.com/apache/pulsar/issues/7333


   **Describe the bug**
   Create a producer with a schema from a polo class returns a schema parse 
exception
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Create a class LineItem:
   public class LineItem {
       public int orderNbr;
       public int partNbr;
       public int supplierNbr;
       public int lineNbr;
       public Double quantity;
       public Double extendedPrice;
       public Double discount;
       public String shipDate;
       public String comment;
   }
   2. Create a new producer with an Avro schema from the LineItem class
   
   Producer<LineItem> producer = client.newProducer(Schema.JSON(LineItem.class))
   .topic(topicName)
   
   3. Expected a new producer but an exception is thrown instead:
   
   Exception in thread “main” 
org.apache.pulsar.shade.org.apache.avro.SchemaParseException: Illegal character 
in: this$0
           at 
org.apache.pulsar.shade.org.apache.avro.Schema.validateName(Schema.java:1532)
           at 
org.apache.pulsar.shade.org.apache.avro.Schema.access$400(Schema.java:87)
           at 
org.apache.pulsar.shade.org.apache.avro.Schema$Field.<init>(Schema.java:520)
           at 
org.apache.pulsar.shade.org.apache.avro.Schema$Field.<init>(Schema.java:559)
           at 
org.apache.pulsar.shade.org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:630)
           at 
org.apache.pulsar.shade.org.apache.avro.specific.SpecificData$3.computeValue(SpecificData.java:335)
           at 
org.apache.pulsar.shade.org.apache.avro.specific.SpecificData$3.computeValue(SpecificData.java:332)
           at java.lang.ClassValue.getFromHashMap(ClassValue.java:227)
           at java.lang.ClassValue.getFromBackup(ClassValue.java:209)
           at java.lang.ClassValue.get(ClassValue.java:115)
           at 
org.apache.pulsar.shade.org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:346)
           at 
org.apache.pulsar.client.impl.schema.StructSchema.extractAvroSchema(StructSchema.java:174)
           at 
org.apache.pulsar.client.impl.schema.StructSchema.createAvroSchema(StructSchema.java:161)
           at 
org.apache.pulsar.client.impl.schema.StructSchema.parseSchemaInfo(StructSchema.java:187)
           at 
org.apache.pulsar.client.impl.schema.JSONSchema.of(JSONSchema.java:96)
           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:498)
           at 
org.apache.pulsar.client.internal.DefaultImplementation.lambda$newJSONSchema$26(DefaultImplementation.java:242)
           at 
org.apache.pulsar.client.internal.ReflectionUtils.catchExceptions(ReflectionUtils.java:35)
           at 
org.apache.pulsar.client.internal.DefaultImplementation.newJSONSchema(DefaultImplementation.java:239)
           at org.apache.pulsar.client.api.Schema.JSON(Schema.java:260)
           at CsvExample.createProducer(CsvExample.java:139)
           at CsvExample.sendMessages(CsvExample.java:44)
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to