Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10282

[Avro] Issue on OSGi due to static cache

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.17.3
    • Fix Version/s: 2.16.4, 2.17.4, 2.18.0
    • Component/s: camel-avro
    • Labels:
      None

      Description

      Avro holds a cache of classloaders and other reflection related classes in a static map here:

      https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java#L52-L57

      Keys of that map are {{String}}s with classname.

      The cache is never updated, and this breaks OSGi ability to update a new class definition, since avro will keep pointing to the old version.

      This will lead to a situation where, on an OSGi platform, you are exposed to ClassCastException since the rest of the platform might see a different varsion than the old one cached by avro.

      The attached fix is a simple way to entirely bypass this caching behavior with just public subclasses that turn off just the caching behavior.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                acosentino Andrea Cosentino
                Reporter:
                paolo.antinori Paolo Antinori
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: