[ 
https://issues.apache.org/jira/browse/AVRO-914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philip Zeyliger updated AVRO-914:
---------------------------------

    Attachment: AVRO-914.patch.txt

Attached patch does instanceof before cast.  Wraps if it can't cast.

It passes "mvn test".
                
> SpecificResponder casts Throwable to Exception; fails for OutOfMemoryError
> --------------------------------------------------------------------------
>
>                 Key: AVRO-914
>                 URL: https://issues.apache.org/jira/browse/AVRO-914
>             Project: Avro
>          Issue Type: Bug
>            Reporter: Philip Zeyliger
>         Attachments: AVRO-914.patch.txt
>
>
> I have the following stack frame in an application i'm working with:
> {quote}
> java.lang.ClassCastException: java.lang.OutOfMemoryError cannot be cast to 
> java.lang.Exception 
> at 
> org.apache.avro.ipc.specific.SpecificResponder.respond(SpecificResponder.java:90)
>  
> at org.apache.avro.ipc.Responder.respond(Responder.java:149) 
> at org.apache.avro.ipc.SocketServer$Connection.run(SocketServer.java:116) 
> at java.lang.Thread.run(Thread.java:662)
> {quote}
> Nothing too surprising, here's the code:
> {noformat}
>   @Override
>   public Object respond(Message message, Object request) throws Exception {
> ...
>     } catch (InvocationTargetException e) {
>       throw (Exception)e.getTargetException();
> ...
> {noformat}
> It's probably a bug that this ends up with a ClassCastException.  Any 
> suggestions?  I don't think we can change the signature to Exception.  We 
> could check instanceof and wrap the Throwable if it's not an Exception?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to