From f740ef88932fe3001f1202584686a6486327cf44 Mon Sep 17 00:00:00 2001 From: Daniel Rall Date: Tue, 13 Aug 2002 19:58:49 +0000 Subject: [PATCH] getCause(Throwable): Added detection of SQLException and its getNextException() method pointed out by Costin M., Paul Jack, and Nicola Ken Barozzi. They've also suggested some more general patterns which we're discussing the addition of on the commons-dev@jakarta.apache.org list. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136964 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang/exception/ExceptionUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/java/org/apache/commons/lang/exception/ExceptionUtils.java b/src/java/org/apache/commons/lang/exception/ExceptionUtils.java index c9a560deb..a5f5ccbdf 100644 --- a/src/java/org/apache/commons/lang/exception/ExceptionUtils.java +++ b/src/java/org/apache/commons/lang/exception/ExceptionUtils.java @@ -56,6 +56,7 @@ package org.apache.commons.lang.exception; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.sql.SQLException; /** * Utility routines for manipulating Throwable objects. @@ -110,6 +111,10 @@ public class ExceptionUtils { cause = ((NestableRuntimeException) t).getCause(); } + else if (t instanceof SQLException) + { + cause = ((SQLException) t).getNextException(); + } else { Method getCause = null;