Removed the support for exceptions with a field named 'detail'. It's been there since the beginning, but does not seem like a very important use case. LANG-491
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@895131 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99b21a45ef
commit
d7a5c76170
|
@ -167,7 +167,7 @@ public class ExceptionUtils {
|
|||
}
|
||||
}
|
||||
|
||||
return getCauseUsingFieldName(throwable, "detail");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -223,35 +223,6 @@ public class ExceptionUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Finds a <code>Throwable</code> by field name.</p>
|
||||
*
|
||||
* @param throwable the exception to examine
|
||||
* @param fieldName the name of the attribute to examine
|
||||
* @return the wrapped exception, or <code>null</code> if not found
|
||||
*/
|
||||
private static Throwable getCauseUsingFieldName(Throwable throwable, String fieldName) {
|
||||
Field field = null;
|
||||
try {
|
||||
field = throwable.getClass().getField(fieldName);
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
// exception ignored
|
||||
} catch (SecurityException ignored) {
|
||||
// exception ignored
|
||||
}
|
||||
|
||||
if (field != null && Throwable.class.isAssignableFrom(field.getType())) {
|
||||
try {
|
||||
return (Throwable) field.get(throwable);
|
||||
} catch (IllegalAccessException ignored) {
|
||||
// exception ignored
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// exception ignored
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Counts the number of <code>Throwable</code> objects in the
|
||||
|
|
Loading…
Reference in New Issue