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

Fix bug when using custom classloader

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.3
    • 1.7.4
    • java
    • classloader

    Description

      I created a SpecificResponder with a SpecificData which contains my custom classloader (Play Framework's custom classloader actually). However, it's a real pain to do because SpecificResponder.getDatumReader and SpecificResponder.getDatumWriter don't use the SpecificData that I passed in. When creating a new object those two methods should use the SpecificData object that was passed in the constructor.

      SpecificResponder.java
        @Override
        protected DatumWriter<Object> getDatumWriter(Schema schema) {
          // It currently uses SpecificData.INSTANCE which makes using a different ClassLoader very difficult
          // return new SpecificDatumWriter<Object>(schema);
          return new SpecificDatumWriter<Object>(schema, data);
        }
      
        @Override
        protected DatumReader<Object> getDatumReader(Schema actual, Schema expected) {
          // It currently uses SpecificData.INSTANCE which makes using a different ClassLoader very difficult
          // return new SpecificDatumReader<Object>(actual, expected);
          return new SpecificDatumReader<Object>(actual, expected, data);
        }
      

      Attachments

        1. AVRO-1247.txt
          19 kB
          Doug Cutting
        2. AVRO-1247.txt
          18 kB
          Doug Cutting

        Activity

          People

            cutting Doug Cutting
            chengas123 Java Developer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified