Nuevo método para obtener la causa raiz de una excepción.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package common;
|
package common;
|
||||||
|
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -16,4 +17,13 @@ public class Utils {
|
|||||||
// return stripAccents(input).toLowerCase();
|
// return stripAccents(input).toLowerCase();
|
||||||
return input.toLowerCase();
|
return input.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Throwable getExceptionRootCause(Throwable throwable) {
|
||||||
|
Objects.requireNonNull(throwable);
|
||||||
|
Throwable rootCause = throwable;
|
||||||
|
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
|
||||||
|
rootCause = rootCause.getCause();
|
||||||
|
}
|
||||||
|
return rootCause;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user