db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r880680 - /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
Date Mon, 16 Nov 2009 09:05:31 GMT
Author: kahatlen
Date: Mon Nov 16 09:05:22 2009
New Revision: 880680

URL: http://svn.apache.org/viewvc?rev=880680&view=rev
Log:
DERBY-3809: Add a SHOW FUNCTIONS command to ij

Catch AbstractMethodError raised when the driver doesn't implement the
getFunctions() method introduced in JDBC 4.0, and report that SHOW
FUNCTIONS is not available for the driver.

Patch contributed by Sylvain Leroux <sylvain@chicoree.fr>.

Modified:
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj?rev=880680&r1=880679&r2=880680&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Mon Nov 16 09:05:22
2009
@@ -824,9 +824,22 @@
                 throw ijException.notAvailableForDriver(dbmd.getDriverName());
             } catch(IllegalAccessException iae) {
                 throw ijException.notAvailableForDriver(dbmd.getDriverName());
+            } catch(AbstractMethodError ame) {
+                // According to http://bugs.sun.com/view_bug.do?bug_id=6531596
+                // invoke() may throw AbstractMethodError instead of
+                // InvocationTargetException on some JREs
+                throw ijException.notAvailableForDriver(dbmd.getDriverName());
             } catch(InvocationTargetException ite) {
-                // getFunctions throws only SQLException
-                throw (SQLException)ite.getCause();
+                Throwable cause = ite.getCause();
+                // 'cause' *must* be an SQLException if the method is
+                // *actually* called. But may be AbstractMethodError in some
+                // cases, if the driver implements an older version of the
+                // JDBC spec (pre-JDBC 4.0). See issue DERBY-3809.
+                if (cause instanceof SQLException)
+                    throw (SQLException)cause;
+
+                // else
+                throw ijException.notAvailableForDriver(dbmd.getDriverName());
             }
 
             int[] displayColumns = new int[] {



Mime
View raw message