commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zheng Xie <gnehz...@gmail.com>
Subject [lang] ExceptionUtils
Date Fri, 06 Oct 2017 15:18:41 GMT
Hi.

I have found the design of three root cause related methods inconsistent
when the input Throwable does not wrap up another Throwable.

These three methods are

   1. getRootCause(Throwable t)
   2. getRootCauseMessage(Throwable t)
   3. getRootCauseStackTrace(Throwable t)


When the input t has no lower level cause:

   - the first method returns null;
   - the second method returns the message of t, which means the input t is
   considered as the root cause in this method;
   - the third method returns the stack trace of t, which also means this
   method considers t as the root cause.

Therefore, I consider the design of the first method is not consistent with
the second and the third.

I usually write a function myself to get the root cause of an exception;
and it makes much better sense to me the root cause of a Throwable is
itself if no more lower level cause exists.

A request: change the first method to return t itself when there is no more
'causes'.


tigger






In
The 'getRootCause(Throwable t)' method returns null if the parameter t has
no next level cause.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message