You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Andrew Dodd (JIRA)" <ji...@apache.org> on 2012/07/28 22:28:34 UTC
[jira] [Created] (THRIFT-1663) Java Thrift server is not throwing
exceptions
Andrew Dodd created THRIFT-1663:
-----------------------------------
Summary: 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
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
[jira] [Commented] (THRIFT-1663) Java Thrift server is not throwing
exceptions
Posted by "Andrew Dodd (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437509#comment-13437509 ]
Andrew Dodd commented on THRIFT-1663:
-------------------------------------
I'm not certain this is a duplicate. That bug is describing unexpected exception, whereas this is an exception that is on the signature of the method.
> 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
[jira] [Closed] (THRIFT-1663) Java Thrift server is not throwing
exceptions
Posted by "Jake Farrell (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Commented] (THRIFT-1663) Java Thrift server is not throwing
exceptions
Posted by "Elia (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13430956#comment-13430956 ]
Elia commented on THRIFT-1663:
------------------------------
This is may a duplicate of THRIFT-1658
> 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
>
> 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
[jira] [Commented] (THRIFT-1663) Java Thrift server is not throwing
exceptions
Posted by "Jake Farrell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439235#comment-13439235 ]
Jake Farrell commented on THRIFT-1663:
--------------------------------------
Tutorial java output is showing the correct result as expected from the try catch
JavaClient.java
---
try {
int quotient = client.calculate(1, work);
System.out.println("Whoa we can divide by 0");
} catch (InvalidOperation io) {
System.out.println("Invalid operation: " + io.why);
}
Output
---
ping()
1+1=2
Invalid operation: Cannot divide by 0
15-10=5
Check log: 5
> 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