Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2641

Generated code results in java.lang.ClassCastException when deserializing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.8.0
    • 1.9.2
    • java
    • None

    Description

      SpecificRecord put() used by datumreader does not account for that String fields can be represented as org.apache.avro.util.Utf8 or other CharSequence which might not be castable to java.lang.String.

      The result is that  when it tries to deserialize Utf8-fields it fails with a ClassCastException.

      Proposed solution: toString() instead of cast for Strings.

       

      To reproduce error: Serialize schema with String definitions from the .Net Avro library, ex Confluent.Apache.Avro. It will default to UTF-8 for strings, and fail when deserializing the same schema from the JVM.

      Attachments

        Issue Links

          Activity

            People

              mhelleborg Magne Moss Helleborg
              mhelleborg Magne Moss Helleborg
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: