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

Christopher Tubbs reopened THRIFT-3445:
---------------------------------------

I don't think this is invalid. The issue appears to be:

Thrift's Java code generation for custom exceptions does not generate a 
`getMessage()` method. Instead, it generates a `toString()`. The Throwable 
implementation's toString is sufficient, if Thrift provided a proper generated 
`getMessage()` implementation.

If all you are doing is printing the exception, this doesn't matter. However, 
lots of logging libraries use `exception.getMessage()`. Since this method is 
not part of the code generation, the default one is used, which uses the 
message passed in the Throwable constructor. However, while TException does 
call `super(message)`, the generated code for custom exceptions does not call 
TException's `super(message)`, so the message is null.

This is definitely a valid issue and should be fixed.

I think the best fix is to change the code generation to override 
`getMessage()` instead of `toString()`, and rely on the default `toString()` 
implementation from Throwable.

> Throwable messages are hidden from JVM stack trace output
> ---------------------------------------------------------
>
>                 Key: THRIFT-3445
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3445
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Derek Dagit
>            Priority: Major
>             Fix For: 0.10.0
>
>
> As a user, I expect messages given when constructing Throwables to be 
> accessible via Throwable#getMessage, so that they are logged in stack trace 
> output for debugging.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to