[
https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13534770#comment-13534770
]
Sébastien Launay commented on AVRO-732:
---------------------------------------
I understand your concern but if you stand from the responder point of view you
don't want to have a transport exception when implementing your interface.
When are you supposed to throw a AvroRemoteException or IOException, actually
never I think because these exceptions comes from the transport layer not the
business layer (except maybe some not wanted runtime exceptions like NPE but
you want the framework to translate those automatically I guess).
On the other hand when using the requestor you want to catch transport errors
and differentiate them with business errors indeed. This can be achieved easily
with the generic API where you will have documented access to these transport
exceptions but not with specific or reflect API because you use a Java
interface without those exceptions explicitly declared.
It's common practice to use a POJO business interface (not tied to the
transport layer) for exporting services like Spring does:
[http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/remoting.html]
I agree that catching an undocumented (from the business interface definition)
runtime exception when calling a method is not straightforward but that is also
the beauty of it where you can implement a retry logic in a higher level (e.g.
where you manage the transaction state) or at this very level through an aspect.
Existing AvroRemoteException in methods is viral because you need to declare
that exception recursively in the higher levels if you want to manage it there.
I guess most people don't add the AvroRemoteException to every methods in there
interface either when using the reflect API (not the recommended one though)
where it is mandatory today in the specific API.
> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
> Key: AVRO-732
> URL: https://issues.apache.org/jira/browse/AVRO-732
> Project: Avro
> Issue Type: Bug
> Components: java
> Reporter: Sharad Agarwal
> Fix For: 1.8.0
>
> Attachments:
> AVRO-732-remove-generated-remote-exception-2012-12-11.patch,
> AVRO-732-remove-generated-remote-exception-2012-12-17.patch
>
>
> If user does NOT define the throws clause in the idl, the code is generated
> with "throws AvroRemoteException" clause. However on throwing the
> AvroRemoteException from the implementation, the serialization fails. This is
> not intuitive to users.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira