lynnmatrix edited a comment on issue #6612: Failed to decode long type fields 
in json schema message
URL: https://github.com/apache/pulsar/issues/6612#issuecomment-604261397
 
 
   GenericJsonRecord.java
   ```java
       public Object getField(String fieldName) {
           JsonNode fn = this.jn.get(fieldName);
           if (fn.isContainerNode()) {
               AtomicInteger idx = new AtomicInteger(0);
               List<Field> fields = 
(List)Lists.newArrayList(fn.fieldNames()).stream().map((f) -> {
                   return new Field(f, idx.getAndIncrement());
               }).collect(Collectors.toList());
               return new GenericJsonRecord(this.schemaVersion, fields, fn);
           } else if (fn.isBoolean()) {
               return fn.asBoolean();
           } else if (fn.isInt()) {
               return fn.asInt();
           } else if (fn.isFloatingPointNumber()) {
               return fn.asDouble();
           } else {
               return fn.isDouble() ? fn.asDouble() : fn.asText();
           }
       }
   ```
   GenericJsonRecord::getField does not check whether the field is long type, 
and decode long field by 'fn.asText()'

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


With regards,
Apache Git Services

Reply via email to