Hi Abhishek,

Avro 1.9.0 introduced a change in the generated protocols that removes the
throws clause for AvroRemoteException.
Since then, any undeclared exception is wrapped in an AvroRuntimeException.

Kind regards,
Oscar

On Fri, 24 Jun 2022 at 15:01, Abhishek Dasgupta <
abhishekdasgupta...@gmail.com> wrote:

> Hi Oscar,
>   Thanks for the reply. Actually I'm trying to migrate from Avro
> 1.7.6-cdh5.12.0 to 1.11.0 in my codebase.  We had these Avro IDL files that
> generated the POJOs having methods with "throws  AvroRemoteException"
> clause even though there is no "throws" clause specified in their
> corresponding IDL file's RPC message.
>
>
> Currently in avro idl files with avro version 1.7.6-cdh5.12.0:
>
> void foo(int arg);     // no throws clause present
>
> so the generated Avro POJO has:
>
> void foo(int arg) throws AvroRemoteException.    // AvroRemoteException 
> generated even though no throws clause was present in IDL file
>
>
> When I upgraded the avro version to 1.11.0, the generated POJOs don't
> contain the throws clause in these methods.
>
>
> After avro version upgrade to 1.11.0,  :
>
> void foo(int arg);     // no throws clause present
>
> so the generated Avro POJO has:
>
> void foo(int arg).  // no throws clause present after upgrade
>
>
>
>  I am unable to understand how these "throws" clauses were generated
> earlier ?
>
> What to specify in the avro IDL file's RPC messages so that they exactly
> throw AvroRemoteException in their generated POJOs ? Since a lot error
> handling is based on this exception in my codebase which results in
> compilation issues.
>
> On Thu, Jun 16, 2022 at 12:54 PM Oscar Westra van Holthe - Kind <
> os...@westravanholthe.nl> wrote:
>
>> Hi Abhishek,
>>
>> The throws something in your protocol will be compiled into a throws
>> something in Java.
>> The definition of something must be an error (not a record), which will
>> be compiled into a subclass of AvroRemoteException.
>>
>> So while your exact requirement cannot be satisfied, you will get
>> something similar.
>>
>>
>> Kind regards,
>> Oscar
>>
>>
>> On Wed, 15 Jun 2022 at 14:57, Abhishek Dasgupta <
>> abhishekdasgupta...@gmail.com> wrote:
>>
>>> I want the Avro generated Java class methods to have throws
>>> AvroRemoteException ? How to code this in my Avro IDL file ?
>>>
>>> Suppose I have this RPC message in my Avro protocol:
>>>
>>> void foo(int arg) throws something;
>>>
>>> so the generated Avro POJO has:
>>>
>>> void foo(int arg) throws AvroRemoteException
>>>
>>> What should put instead of something ?
>>>
>>> Using Avro 1.11.0
>>>
>>
>>
>> --
>>
>> ✉️ Oscar Westra van Holthe - Kind <os...@westravanholthe.nl>
>>
>>

-- 

✉️ Oscar Westra van Holthe - Kind <os...@westravanholthe.nl>

Reply via email to