[ 
https://issues.apache.org/jira/browse/THRIFT-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15117875#comment-15117875
 ] 

Marc Breslow commented on THRIFT-2157:
--------------------------------------

Hi [~iker.jimenez] and [~dvdreddy], I took a stab at resolving this: 
https://github.com/apache/thrift/pull/822

Per your comments, I:
* Introduced a new interface called TSerializable and pulled up the read() and 
write() methods from TBase
* Made TBase extend TSerializable
* Made TApplicationException implement TSerializable. This entailed replacing a 
static method {code:java}public static TApplicationException read(TProtocol 
iprot) throws TException{code} with an instance method that returns 
{code:java}void{code}
* Updated {code:java}org.apache.thrift.TServiceClient#receiveBase{code} to use 
the TException.read() instance method instead of the static method it was using 
before. 

> generated code would cause ClassCastException
> ---------------------------------------------
>
>                 Key: THRIFT-2157
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2157
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.9.1
>            Reporter: Dave Brosius
>            Priority: Trivial
>
> Looking at the thrift generated code for cassandra, i'm seeing
>  msg = (org.apache.thrift.TBase)new 
> org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR,
>  e.getMessage());
> as seen here
> https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java;h=837acfc0e964249fd62720420e8f1f85d966f1a3;hb=8f202895ab9e17c3d6bd4965924fd5f1ffc27f94#l6095
> i don't see how TApplicationException can be cast to TBase, and so i'd expect 
> a ClassCastException there.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to