Nuevo método para obtener la causa raiz de una excepción.

This commit is contained in:
Marcos Garcia Nuñez
2019-12-20 17:57:56 +01:00
parent c8a3f1e933
commit ed78633291

View File

@@ -1,6 +1,7 @@
package common;
import java.text.Normalizer;
import java.util.Objects;
/**
*
@@ -13,7 +14,16 @@ public class Utils {
}
public static String normalizeTerm(String input) {
//return stripAccents(input).toLowerCase();
// return stripAccents(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;
}
}