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

creating a record called "Exception" leads to generated code not compiling

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.7, 1.8.1, 1.9.0
    • 1.9.0, 1.8.2
    • java
    • None

    Description

      consider the following *.avsc file:

      Exception.avsc
      {
        "type": "record",
        "name": "Exception",
        "namespace": "com.acme",
        "fields" : [
          {"name": "value", "type": "int"}
        ],
        "doc": "Will not submit to your fascist naming conventions"
      }
      

      the generated java code will contain:

      Exception.java
      ...
      @override
      public Exception build() {
         try {
            ...
            return record;
         } catch (Exception e) { //boom
            throw new org.apache.avro.AvroRuntimeException(e);
         }
      }
      

      which fails to compile because Exception refers to the generated class (which does not extend Throwable)

      Attachments

        Activity

          People

            nielsbasjes Niels Basjes
            radai Radai Rosenblatt
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: