You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jake Farrell (JIRA)" <ji...@apache.org> on 2012/08/08 17:42:21 UTC

[jira] [Closed] (THRIFT-1663) Java Thrift server is not throwing exceptions

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

Jake Farrell closed THRIFT-1663.
--------------------------------

       Resolution: Duplicate
    Fix Version/s: 0.9
         Assignee: Jake Farrell
    
> Java Thrift server is not throwing exceptions
> ---------------------------------------------
>
>                 Key: THRIFT-1663
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1663
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.8
>            Reporter: Andrew Dodd
>            Assignee: Jake Farrell
>             Fix For: 0.9
>
>
> 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

--
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