commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Schumacher (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LANG-1364) ExceptionUtils#getRootCause* inconsistency
Date Sat, 28 Oct 2017 18:54:00 GMT
Pascal Schumacher created LANG-1364:
---------------------------------------

             Summary: ExceptionUtils#getRootCause* inconsistency
                 Key: LANG-1364
                 URL: https://issues.apache.org/jira/browse/LANG-1364
             Project: Commons Lang
          Issue Type: Bug
            Reporter: Pascal Schumacher


{quote}
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'.
{quote}

Reported by Zheng Xie in https://mail-archives.apache.org/mod_mbox/commons-dev/201710.mbox/%3CCAL-LHk7jvQGM9J1SPxLB2qEsXazwwq%2BYKuv29XgWXEcccHUn0w%40mail.gmail.com%3E




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message