Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
0.8
-
None
Description
Whilst trying out Thrift using the tutorial code, I noticed the message "Whoa we can divide by 0" being shown in the console, indicating that the InvalidOperationException was not being thrown to the client.
Looking at the tutorial code, the method calculate returns i32. Digging in a bit, in the recv_calculate() method that the client excuted, I can see that if the isSetSuccess method returns true (which it always does as success is set to 0 in the server; this field actually appears to be the field where the return value of the function is stored) then the value of success is returned.
To fix this, I have changed the order of the following code:
if (result.isSetSuccess())
{ return result.success; }if (result.ouch != null)
{ throw result.ouch; }By putting the check for the exception first, then the exception is thrown correctly.
Since I'm new to Thrift I have no idea what the correct solution to this bug would be.
Also, this appears to be a reproduction of this issue: http://mail-archives.apache.org/mod_mbox/thrift-user/201112.mbox/ajax/%3C2672B8B3-5A1F-4656-B335-8EE109DEA38E%40163.com%3E
Attachments
Issue Links
- duplicates
-
THRIFT-1658 Java thrift server is not throwing TApplicationException
- Closed