thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer" <>
Subject Re: Why isn't TException a subclass of RuntimeException in Java?
Date Thu, 03 Sep 2015 18:37:15 GMT

I somehow overlooked that part of the equation => Agree with Randy.

-----Urspr√ľngliche Nachricht----- 
From: Randy Abernethy
Sent: Thursday, September 3, 2015 2:58 PM
Subject: Re: Why isn't TException a subclass of RuntimeException in Java?

Hey All,

In Java TException is derived from the java Exception class. Per the Java

>> The class Exception and its subclasses are a form of Throwable that
>> conditions that a reasonable application might want to catch.

Sounds like what we want.

>> The class Exception and any subclasses that are not also subclasses of
>> RuntimeException are checked exceptions. Checked exceptions need to be
>> declared in a method or constructor's throws clause if they can be
thrown by
>> the execution of the method or constructor and propagate outside the
>> or constructor boundary.

So changing to RuntimeException as a base would make TException silently
throwable in Java, (which is the proposal).

In Apache Thrift, user defined exceptions which can be thrown from the
back to the client could then easily go uncaught. Also
which can always be thrown by a thrift server back to a client (even if the
doesn't define exceptions) could leak through. While I'm not a big fan of
syntax, if your going to code in Java it seems like declaring throws
is not a huge (or at least unusual) burden. In the greater scheme on things
an RPC call is a risky operation.

I was against this proposal until I began looking for idiomatic Java
behavior in
this area, where I found several examples using RuntimeException as the
For example the method (used to make
REST calls in JAXRS) throws ResponseProcessingException which is unchecked.


So while I personally like the checked approach it seems we would be more
inline with common practice if we switch to RuntimeException as a base.



On Thu, Sep 3, 2015 at 2:45 AM, Jens Geyer <> wrote:

> Some of the other languages actually do that. What about providing a 
> patch?
> ________________________________
> Von: J
> Gesendet: 02.09.2015 21:38
> An:
> Betreff: Why isn't TException a subclass of RuntimeException in Java?
> It seems tedious to have to mark every method that does a thrift rpc call
> with "throws TException" or have to put a try-catch around every call. Why
> wasn't TException made a subclass of RuntimeException? I think many RPC
> implementations I've used usually make the rpc/proxy errors runtime
> exceptions. There usually isn't anything you can do about it locally in 
> the
> client call anyway.

View raw message