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

SpecificDatumReader should allow users to specify the ClassLoader used.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.6.0
    • java
    • None
    • Reviewed

    Description

      Right now SpecificData resolves classes for SpecificRecords by calling Class.forName(), which uses the ClassLoader used to load the SpecificData class. I believe this makes it impossible to deserialize into SpecificRecords that are loaded using a different ClassLoader.

      One relatively simple way to fix this limitations involves:

      • Adding a constructor to SpecificData that allows the user to specify a ClassLoader.
      • Changing the current protected constructor of SpecificDatumReader that takes a SpecificData to be public instead of protected.
      • Changing SpecificDatumReader to actually use the SpecificData that is passed into the constructor.

      Attachments

        1. specificDataClassLoader2.patch
          3 kB
          Michael Armbrust

        Issue Links

          Activity

            People

              marmbrus Michael Armbrust
              marmbrus Michael Armbrust
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: