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:
Henri Yandell 2010-01-02 06:07:11 +00:00
parent 99b21a45ef
commit d7a5c76170
1 changed files with 1 additions and 30 deletions

View File

@ -167,7 +167,7 @@ public static Throwable getCause(Throwable throwable, String[] methodNames) {
}
}
return getCauseUsingFieldName(throwable, "detail");
return null;
}
/**
@ -223,35 +223,6 @@ private static Throwable getCauseUsingMethodName(Throwable throwable, String met
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