Bug#30929. Shorn Tolley pointed out that using equals() means you can't pass

SQLException in and expect to get back extensions of SQLException.  Switching
to isAssignableFrom allows you to do this.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137942 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2004-09-30 06:21:40 +00:00
parent cc95d41828
commit 2a041e2778
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Pete Gieser
* @since 1.0
* @version $Id: ExceptionUtils.java,v 1.39 2004/07/04 03:24:57 bayard Exp $
* @version $Id: ExceptionUtils.java,v 1.40 2004/09/30 06:21:40 bayard Exp $
*/
public class ExceptionUtils {
@ -434,7 +434,7 @@ public static int indexOfThrowable(Throwable throwable, Class type, int fromInde
return -1;
}
for (int i = fromIndex; i < throwables.length; i++) {
if (throwables[i].getClass().equals(type)) {
if (type.isAssignableFrom(throwables[i].getClass())) {
return i;
}
}

View File

@ -41,7 +41,7 @@
* @author Sean C. Sullivan
* @author Stephen Colebourne
* @since 1.0
* @version $Id: NestableDelegate.java,v 1.23 2004/02/18 22:54:04 ggregory Exp $
* @version $Id: NestableDelegate.java,v 1.24 2004/09/30 06:21:40 bayard Exp $
*/
public class NestableDelegate implements Serializable {
@ -236,7 +236,7 @@ public int indexOfThrowable(Class type, int fromIndex) {
+ fromIndex + " >= " + throwables.length);
}
for (int i = fromIndex; i < throwables.length; i++) {
if (throwables[i].getClass().equals(type)) {
if (type.isAssignableFrom(throwables[i].getClass())) {
return i;
}
}