Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.8, 3.8.1
-
None
-
None
Description
In version 3.8 the following bugfix was introduced:
LANG-1364: ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists Thanks to Zheng Xie.
In general I agree with the consistency it brings, but now the javadocs is not agreeing with the way it actually works.
/** 168 * <p>Introspects the <code>Throwable</code> to obtain the root cause.</p> 169 * 170 * <p>This method walks through the exception chain to the last element, 171 * "root" of the tree, using {@link Throwable#getCause()}, and 172 * returns that exception.</p> 173 * 174 * <p>From version 2.2, this method handles recursive cause structures 175 * that might otherwise cause infinite loops. If the throwable parameter 176 * has a cause of itself, then null will be returned. If the throwable 177 * parameter cause chain loops, the last element in the chain before the 178 * loop is returned.</p> 179 * 180 * @param throwable the throwable to get the root cause for, may be null 181 * @return the root cause of the <code>Throwable</code>, 182 * <code>null</code> if null throwable input 183 */
The sentence at line 175/176 should be something like:
If the throwable parameter has a cause of itself, then itself will be returned.
As the method will not return null, but itself instead, as of the fix LANG-1364