Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
None
-
None
-
None
Description
When using a generated Async Processor for any service, there is a class cast exception that can happen when you call the onError function on a returned AsyncMethodCallback (returned from any class that extends AsyncProcessFunction) with an exception other than the expected exception for that method
This occurs because the org.apache.thrift.TApplicationException being cast as (org.apache.thrift.TBase) in the generated code for a service
indent(f_service_) << "{" << endl; indent_up(); indent(f_service_) << "msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;" << endl; indent(f_service_) << "msg = (org.apache.thrift.TBase)new " "org.apache.thrift.TApplicationException(org.apache.thrift." "TApplicationException.INTERNAL_ERROR, e.getMessage());" << endl; indent_down(); indent(f_service_) << "}" << endl;
link : code-in-github-trunk
There are two ways to solve this :
- one is make TApplicationException to extend TBase
- another is to change the code generation logic here
I can put up a patch based on what approach is advised ?
Attachments
Issue Links
- duplicates
-
THRIFT-2157 generated code would cause ClassCastException
- Closed
- is duplicated by
-
THRIFT-2157 generated code would cause ClassCastException
- Closed