mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-04 16:35:08 -05:00
87e8d830ce
notes: * updated to MigLayout 3.6.3 * better exception handling in *TransferablePolicy * added checksum toggle button and artwork * poperly cancel computation tasks on reset * better "Total Progress" visibility behaviour * improved checksum table model classes, better update/repaint behaviour
49 lines
890 B
Java
49 lines
890 B
Java
|
|
package net.sourceforge.tuned;
|
|
|
|
|
|
public final class ExceptionUtilities {
|
|
|
|
public static Throwable getRootCause(Throwable t) {
|
|
while (t.getCause() != null) {
|
|
t = t.getCause();
|
|
}
|
|
|
|
return t;
|
|
}
|
|
|
|
|
|
public static String getRootCauseMessage(Throwable t) {
|
|
return getMessage(getRootCause(t));
|
|
}
|
|
|
|
|
|
public static String getMessage(Throwable t) {
|
|
String message = t.getMessage();
|
|
|
|
if (message == null || message.isEmpty()) {
|
|
message = t.toString().replaceAll(t.getClass().getName(), t.getClass().getSimpleName());
|
|
}
|
|
|
|
return message;
|
|
}
|
|
|
|
|
|
public static RuntimeException asRuntimeException(Throwable t) {
|
|
if (t instanceof RuntimeException) {
|
|
return (RuntimeException) t;
|
|
}
|
|
|
|
return new RuntimeException(t);
|
|
}
|
|
|
|
|
|
/**
|
|
* Dummy constructor to prevent instantiation.
|
|
*/
|
|
private ExceptionUtilities() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
}
|