Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Delegate getRootCause through to Guava's implementation #692

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions util/src/main/java/tech/pegasys/pantheon/util/ExceptionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package tech.pegasys.pantheon.util;

import com.google.common.base.Throwables;

public class ExceptionUtils {

private ExceptionUtils() {}
Expand All @@ -23,16 +25,6 @@ private ExceptionUtils() {}
* @return The root cause
*/
public static Throwable rootCause(final Throwable throwable) {
Throwable cause = throwable;

while (cause != null) {
if (cause.getCause() == null) {
break;
}

cause = cause.getCause();
}

return cause;
return throwable != null ? Throwables.getRootCause(throwable) : null;
}
}