filebot/source/net/sourceforge/tuned/ExceptionUtil.java

25 lines
382 B
Java
Raw Normal View History

package net.sourceforge.tuned;
public class ExceptionUtil {
public static Throwable getRootCause(Throwable t) {
while (t.getCause() != null) {
t = t.getCause();
}
return t;
}
public static RuntimeException asRuntimeException(Throwable t) {
if (t instanceof RuntimeException) {
return (RuntimeException) t;
}
return new RuntimeException(t);
}
}