Nuevo método para obtener la causa raiz de una excepción.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package common;
|
||||
|
||||
import java.text.Normalizer;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -11,9 +12,18 @@ public class Utils {
|
||||
public static String stripAccents(String input) {
|
||||
return input == null ? null : Normalizer.normalize(input, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user